use of org.datanucleus.samples.pggeometry.SampleMultiPoint in project tests by datanucleus.
the class PgGeometryMappingTest method testMultiPointMapping.
public void testMultiPointMapping() throws SQLException {
if (!runTestsForDatastore()) {
return;
}
MultiPoint multipoint = new MultiPoint("SRID=4326;MULTIPOINT(10 10,75 75)");
SampleMultiPoint sampleMultiPoint;
SampleMultiPoint sampleMultiPoint_read;
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
Object id = null;
try {
tx.begin();
sampleMultiPoint = new SampleMultiPoint(4001, "MultiPoint", multipoint);
pm.makePersistent(sampleMultiPoint);
id = JDOHelper.getObjectId(sampleMultiPoint);
sampleMultiPoint = (SampleMultiPoint) pm.detachCopy(sampleMultiPoint);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
pm = pmf.getPersistenceManager();
tx = pm.currentTransaction();
try {
tx.begin();
sampleMultiPoint_read = (SampleMultiPoint) pm.getObjectById(id, true);
assertEquals(sampleMultiPoint, sampleMultiPoint_read);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
}
Aggregations