0

I've been struggling with this for a while. Running on Tomcat 7.0.47

Relevant Entity Class snippet:

@Column(name = "geopoint", columnDefinition = "org.postgis.Geometry")
@Type(type = "org.hibernate.spatial.GeometryType")
private com.vividsolutions.jts.geom.Point geopoint;

Here are the libraries I'm using:

Hibernate Spatial 4.0-M1
postgis-jdbc 2.1.0SVN (used 1.5.3 before, same issue.)
Hibernate 4.2.7

Datasource Info

Datasource = org.apache.tomcat.jdbc.pool.DataSource
Driver Class Name = org.postgis.DriverWrapper
JDBC URL Beginning = jdbc:postgresql_postGIS:

The DB is PostgreSql 9.3 on Amazon RDS with PostGIS installed. The column geopoint is of type "point". I created this table using PgAdminIII

Hibernate Session Factory props

 <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
 <prop key="hibernate.dialect">org.hibernate.spatial.dialect.postgis.PostgisDialect</prop>
 <prop key="hibernate.showsql">true</prop>

I've debugged the code to see that the JDBC seems to be returning PGPoint. PGGeometryValueExtractor.toJTS(Object) receives a PGPoint. It seems Hibernate Spatial intends for it to be a org.postgis.Geometry or org.postgis.PGGeometry object.

Any help would be appreciated.

1

1 Answer 1

2

point is a built-in PostgreSQL core type, not a PostGIS type.

I think you want the column type to be geometry if you're going to work with PostGIS. Try changing the column type; if you then store PostGIS points in it, it should behave as expected.

Sign up to request clarification or add additional context in comments.

2 Comments

I think I just figured this out... right as I submitted this question I went and reconfigured the column. I'll report back with my findings. thanks for pointing this out.
Yep. This was it. It's always the little things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.