Search in sources :

Example 1 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial 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 WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class UpdateTests method testUpdateSingleToNull.

public void testUpdateSingleToNull() throws Exception {
    UnitOfWork uow = session.acquireUnitOfWork();
    WrappedSpatial ws = (WrappedSpatial) uow.readObject(WrappedSpatial.class, new ExpressionBuilder().get("geometry").notNull());
    assertNotNull("No WrappedSpatial instances found", ws);
    ws.setGeometry(null);
    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)

Example 3 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class Query_SpatialOp_ExpExp_Tests method populateTestGeometry.

private void populateTestGeometry(JGeometry g) {
    UnitOfWork uow = session.acquireUnitOfWork();
    uow.registerNewObject(new WrappedSpatial(6666, 0, g));
    uow.commit();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)

Example 4 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class SampleGeometries method wrappedPopulation.

public List<WrappedSpatial> wrappedPopulation() throws Exception {
    List<WrappedSpatial> population = new ArrayList<WrappedSpatial>();
    population.add(new WrappedSpatial(1000, 1, pointCluster1()));
    population.add(new WrappedSpatial(1001, 2, pointCluster2()));
    population.add(new WrappedSpatial(1002, 3, simplyPolygon()));
    population.add(new WrappedSpatial(1003, 4, polygonOfCircularArcs()));
    population.add(new WrappedSpatial(1004, 5, circle()));
    population.add(new WrappedSpatial(1005, 6, rectangle()));
    population.add(new WrappedSpatial(1006, 7, compoundLineAndRectangle()));
    population.add(new WrappedSpatial(1007, 8, compoundPolygonWithRectangularHole()));
    population.add(new WrappedSpatial(1008, 9, geometry1008()));
    population.add(new WrappedSpatial(1009, 10, geometryWithNulls()));
    population.add(new WrappedSpatial(1010, 11, null));
    population.add(new WrappedSpatial(1011, 12, polygon1011()));
    population.add(new WrappedSpatial(1012, 13, polygon1012()));
    population.add(new WrappedSpatial(1013, 14, point()));
    return population;
}
Also used : WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial) ArrayList(java.util.ArrayList)

Example 5 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class CreateTests method testInsertNullWithoutBinding.

public void testInsertNullWithoutBinding() throws Exception {
    getSession().getLogin().setShouldBindAllParameters(false);
    UnitOfWork uow = getSession().acquireUnitOfWork();
    WrappedSpatial ss = (WrappedSpatial) uow.newInstance(WrappedSpatial.class);
    ss.setId(123456789);
    uow.writeChanges();
    uow.release();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)

Aggregations

WrappedSpatial (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)10 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)7 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)4 List (java.util.List)2 Expression (org.eclipse.persistence.expressions.Expression)2 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)2 ArrayList (java.util.ArrayList)1 MyGeometry (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.MyGeometry)1 SampleGeometries (org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries)1