Search in sources :

Example 1 with UnitOfWorkChangeSet

use of org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet in project eclipselink by eclipse-ee4j.

the class DirectMapUnitOfWorkTest method test.

@Override
public void test() throws Exception {
    // put a new value in, will now be in the cache
    UnitOfWork uow1 = getSession().acquireUnitOfWork();
    DirectMapMappings maps = (DirectMapMappings) uow1.registerObject(new DirectMapMappings());
    maps.directMap.put(1, "bogus");
    maps.directMap.put(3, "third");
    uow1.commit();
    UnitOfWork uow2 = getSession().acquireUnitOfWork();
    DirectMapMappings mapsClone = (DirectMapMappings) uow2.registerObject(maps);
    mapsClone.directMap.put(2, "axemen");
    mapsClone.directMap.put(1, "guy");
    UnitOfWorkChangeSet changes = uow2.getCurrentChanges();
    uow2.commit();
    ReadObjectQuery query = new ReadObjectQuery(mapsClone);
    mapsQueryResult = (DirectMapMappings) getSession().executeQuery(query);
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery) UnitOfWorkChangeSet(org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet) DirectMapMappings(org.eclipse.persistence.testing.models.directmap.DirectMapMappings)

Aggregations

ReadObjectQuery (org.eclipse.persistence.queries.ReadObjectQuery)1 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)1 UnitOfWorkChangeSet (org.eclipse.persistence.sessions.changesets.UnitOfWorkChangeSet)1 DirectMapMappings (org.eclipse.persistence.testing.models.directmap.DirectMapMappings)1