use of org.datanucleus.samples.jgeometry.SampleGeometryM in project tests by datanucleus.
the class JGeometry3dMMappingTest method testPoint3DMapping.
public void testPoint3DMapping() throws SQLException {
if (!runTestsForDatastore()) {
return;
}
JGeometry point = new JGeometry(10.0, 10.0, 100.0, 4326);
SampleGeometryM samplePoint;
SampleGeometryM samplePoint_read;
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
Object id = null;
try {
tx.begin();
samplePoint = new SampleGeometryM(1201, "Point 3D", point);
pm.makePersistent(samplePoint);
id = JDOHelper.getObjectId(samplePoint);
samplePoint = (SampleGeometryM) pm.detachCopy(samplePoint);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
pm = pmf.getPersistenceManager();
tx = pm.currentTransaction();
try {
tx.begin();
samplePoint_read = (SampleGeometryM) pm.getObjectById(id, true);
assertEquals(samplePoint, samplePoint_read);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
}
Aggregations