Search in sources :

Example 1 with SampleGeometries

use of org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries in project eclipselink by eclipse-ee4j.

the class UpdateTests method testReplaceExisting.

public void testReplaceExisting() {
    UnitOfWork uow = session.acquireUnitOfWork();
    WrappedSpatial ws = (WrappedSpatial) uow.readObject(WrappedSpatial.class, new ExpressionBuilder().get("id").equal(1001));
    assertNotNull("No WrappedSpatial instances found", ws);
    MyGeometry geom = new MyGeometry(30, new SampleGeometries().simplyPolygon());
    ws.setGeometry(geom);
    uow.writeChanges();
    uow.release();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) MyGeometry(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.MyGeometry) SampleGeometries(org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries)

Example 2 with SampleGeometries

use of org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries in project eclipselink by eclipse-ee4j.

the class WrappedSpatialTestCase method repopulate.

public static void repopulate(DatabaseSession session, boolean replaceTables) throws Exception {
    if (replaceTables) {
        replaceTables(session);
    }
    UnitOfWork uow = session.acquireUnitOfWork();
    List existing = uow.readAllObjects(WrappedSpatial.class);
    uow.deleteAllObjects(existing);
    uow.commit();
    session.getIdentityMapAccessor().initializeIdentityMaps();
    SampleGeometries samples = new SampleGeometries(DEFAULT_SRID);
    uow = session.acquireUnitOfWork();
    uow.registerAllObjects(samples.wrappedPopulation());
    uow.commit();
    assertEquals(samples.wrappedPopulation().size(), countWrappedSpatial(session));
    session.getIdentityMapAccessor().initializeIdentityMaps();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) List(java.util.List) SampleGeometries(org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries)

Aggregations

UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)2 SampleGeometries (org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries)2 List (java.util.List)1 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)1 MyGeometry (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.MyGeometry)1 WrappedSpatial (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)1