I have this column defined in postgres 9.4-1204-jdbc4
location geometry(Point,4326)
and i have this pom.xml with these dependencies:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
and i want to store the data stored in this class:
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
@Column(columnDefinition = "geometry(Point,4326)",name="location")
private Point locationPoint;
public void updateLocation(String locationAsString) {
this.location = locationAsString;
int separatorPosition = location.indexOf(" ");
double x_location = Double.parseDouble(location.substring(0,separatorPosition));
double y_location = Double.parseDouble(location.substring(separatorPosition));
//this.locationPoint = new Point(x_location, y_location);
Coordinate coord = new Coordinate(x_location, y_location );
GeometryFactory gf = new GeometryFactory();
this.locationPoint= gf.createPoint( coord );
this.locationPoint.setSRID(4326);
}
but when i try to store the object in db, it always returns me the error:
ERROR: Invalid endian flag value encountered.
I have defined the hibernate dialect this way
spring.jpa.properties.hibernate.dialect =org.hibernate.spatial.dialect.postgis.PostgisDialect
Where could be the problem?