use of org.postgis.PGbox2d in project tests by datanucleus.
the class PgGeometryPostGISExtMappingTest method testBoxMapping.
public void testBoxMapping() throws SQLException {
if (!runTestsForDatastore()) {
return;
}
PGbox2d pgbox2d = new PGbox2d(new Point(10, 10), new Point(20, 20));
PGbox3d pgbox3d = new PGbox3d(new Point(20, 20, 100), new Point(30, 30, 100));
SampleBox sampleBox;
SampleBox sampleBox_read;
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
Object id = null;
try {
tx.begin();
sampleBox = new SampleBox(1001, "PGboxes", pgbox2d, pgbox3d);
pm.makePersistent(sampleBox);
id = JDOHelper.getObjectId(sampleBox);
sampleBox = (SampleBox) pm.detachCopy(sampleBox);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
pm = pmf.getPersistenceManager();
tx = pm.currentTransaction();
try {
tx.begin();
sampleBox_read = (SampleBox) pm.getObjectById(id, true);
assertEquals(sampleBox, sampleBox_read);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
}
Aggregations