title: PostGIS jdbc sql query
body: <p>I'm trying to use postgis extension for postgresql database and can't get it to work in a way I would like to.
  I'm using postgis 2.1.6 (custome build from source) and postgresql-9.4-1201.jdbc4.jar
  (there's additional project with hibernate configuration, but it's probably irelevant for this case).</p>
  
  <p>I have some test code (mainly from postgis example folder):</p>
  
  <pre><code>String dburl="jdbc:postgresql://localhost/mapwebcatalog";
  Connection conn = DriverManager.getConnection(dburl, dbuser, dbpass);
  Statement stat = conn.createStatement();
  
  {
  ResultSet rs = stat.executeQuery("SELECT raw_data_file_points::geometry from raw_data_file_area");
  
  rs.next();
  result = (PGobject) rs.getObject(1);
  if (result instanceof PGgeometry) {
      System.out.println("PGgeometry successful!");
  } else {
      System.out.println("PGgeometry failed!");
  }
  }
  
  {
  ResultSet rs = stat.executeQuery("SELECT raw_data_file_points from raw_data_file_area");
  rs.next();
  result = (PGobject) rs.getObject(1);
  if (result instanceof PGgeometry) {
      System.out.println("PGgeometry successful!");
  } else {
      System.out.println("PGgeometry failed!");
  }
  }
  </code></pre>
  
  <p>When I run, I get "PGgeometry successful!" (for first if) and "PGgeometry failed!" (for second if).
  And difference is just in explicit type for column (::geometry).</p>
  
  <p>Is this normal, or there is something wrong with configuration?
  If this is normal and how it should be, should hibernate generate sql query with type casting?</p>