Persisting PGgeomerty with custom SRID [message #649533] |
Wed, 19 January 2011 15:32 |
Mustafa Messages: 4 Registered: January 2011 |
Junior Member |
|
|
Hello,
I'm using eclipselink 2.1.0, Tomcat 6.0.14, with Posgtresql 8.4 for spatial operations in my project. So far I've managed to create a spatially enabled Entity. My entity seems pretty much like that
@Entity
@Converter(name="geoConverter", convertClass=MyGeoConverter.class)
public class Coverage {
@Convert(geoConverter)
@Column(columnDefiniton = "Geometry")
private Rectangle location;
.
..
}
and here is the Converter class..
public class MyGeoConverter implements Converter {
public Rectangle convertDataValueToObjectValue(Object dataValue, Session s) {
.
..
}
public PGgeometry convertDataValueToObjectValue(Object objectValue, Session s) {
........
PGgeometry geo = new PGgeometry(wkt);
geo.getGeometry().setSrid(4326);
return geo;
}
public void initialize(DatabaseMapping m, Session s) {
m.getFİeld().setSqlType(Types.OTHER);
}
public boolean isMutable() {
return false;
}
}
The problem is; when I create the Coverage entity and persist it, the SRID is always -1 for all the entries but the Coordinates are all OK. It seems like eclipselink is ignoring the SRID when genereting the SQL insert statement, or most probably I'm just missing something.. Any ideas ?
Thank in advance for any suggestions..
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02328 seconds