I'm using Spring with Hibernate Spatial 5.0.12 and trying to persist a com.vividsolutions.jts.geom.Geometry
object to an Oracle database with SDO_GEOMETRY
column but get this exception when trying to save it to the db:
ORA-00932: Inconsistent datatypes: expected MDSYS.SDO_GEOMETRY got BINARY
I haven't found this problem anywhere else and have no idea how to solve it as I'm new to hibernate.
This is the entity I'm trying to save:
@Entity
@Table(name = "DETECTED_OBJECTS")
public class DetectedObject {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "DETECTED_SEQ")
@SequenceGenerator(sequenceName = "detected_seq", allocationSize = 1, name = "DETECTED_SEQ"_
private Long id;
private Geometry polygon;
public DetectedObject(){}
public DetectedObject(Coordinate[] coordinates){
this.polygon = new GeometryFactory().createPolygon(coordinates);
}
}
And this is my hibernate config:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.Oracle10gDialect
spring.jpa.properties.provider_class = org.hibernate.cache.NoCacheProvider
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.format-sql = true
And the actual line that throws the exception:
detectedObjectRepository.save(detectedObject)