I´m migrating an existing application from Hibernate 3.6.10.Final (with hibernate-spatial 1.1.1) to Hibernate 5 ORM, which is supposed to include spatial capabilities. Therefore, I removed the reference to org.hibernatespatial in the pom.xml and upgrade 3.6.10.Final so that I'll have :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.4.Final</version>
</dependency>
Where before I'd have queries created with spatial criteria, I get compilation errors as if it wouldn't find certain classes. For example, before I'd have something like :
import org.hibernatespatial.criterion.SpatialRelateExpression;
import org.hibernatespatial.criterion.SpatialRestrictions;
SpatialRelateExpression geomExpression = SpatialRestrictions.within("geom", area);
criteria.add(geomExpression);
Eclipse will raise that "SpatialRelateExpression cannot be resolved" (same for SpatialRestrictions. Even though I thought it would be enough to change the imports to these :
import org.hibernate.spatial.criterion.SpatialRelateExpression;
import org.hibernate.spatial.criterion.SpatialRestrictions;
And again Eclipse will complain that "The import org.hibernate.spatial cannot be resolved". When I open the hibernate-core-5.0.4.Final.jar and hibernate-entity-manager-5.0.4.Final.jar libraries I can't find an org.hibernate.spatial package, but according to Hibernate 5 documentation about those spatial related classes I'd expect them to be ther.
I tried to Google for this, but maybe because Hibernate 5 has not been in the market for such a long time, I constantly get references to Hibernate 4.
My questions are :
You are missing the hibernate-spatial dependency. It is not being pulled as transitive dependency from hibernate-entitymanager.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>5.0.4.Final</version>
</dependency>
The documentation that you linked to is the documentation of all Hibernate modules combined, not just the core.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With