I woudlike to store in my database :
example data :
ST_GeomFromGML('
<gml:LineString srsName="EPSG:4269">
<gml:coordinates>
-71.16028,42.258729 -71.160837,42.259112 -71.161143,42.25932
</gml:coordinates>
</gml:LineString>');
I made an API with 2 parameters in entry (String id and Geometry shape) :
{
"id": "string",
"shape": {
"envelope": {},
"factory": {
"coordinateSequenceFactory": {},
"precisionModel": {
"scale": 0
}
},
"srid": 0,
"userData": {}
}
}
My model :
Entity
@Table(name = "test", schema = "aaa")
public class rectangle {
@Id
@Column(name = "id", length = 32)
private String id;
@Column(name = "shape")
private Geometry shape;
public rectangle() {
}
public rectangle(String id, Geometry shape) {
this.id = id;
this.shape = shape;
}
How can I parse my example date to my database ?
Docs found about st_GeomFromGml :
There's a hibernate dialect for this case called org.hibernate.spatial.dialect.postgis.PostgisDialect
This is capable of loading and storing geometries directly with JPA to the Postgres DB with PostGis.
At http://www.hibernatespatial.org/documentation/02-Tutorial/01-tutorial4/ you find a tutorial for working with it.