Assume I have the following table
CREATE TABLE foo (
id BIGSERIAL PRIMARY KEY,
polygon GEOMETRY(POLYGON)
);
and entity class
@Table
@Entity
public class Foo {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
private Polygon polygon;
}
I managed to save a Foo entity, however, I can't select it them from the database. I get this exception:
java.lang.NumberFormatException: For input string: "PO"
Then, I added the following annotation on top of polygon field:
@Type(type = "org.hibernate.spatial.JTSGeometryType")
but it throws another exception saying that this type cannot be instantiated:
org.hibernate.MappingException: Could not instantiate Type: org.hibernate.spatial.JTSGeometryType
Please note that I use 5.1.0.Final version for hibernate and hibernate-spatial.
Thank you