Package org.apache.cayenne.testdo.locking

Examples of org.apache.cayenne.testdo.locking.SimpleLockingTestEntity


        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        object.setDescription("second update");

        context.commitChanges();
    }
View Full Code Here


        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        object.setDescription("second update");
        context.invalidateObjects(Collections.singletonList(object));

        context.commitChanges();
    }
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        context.invalidateObjects(Collections.singletonList(object));
        object.setDescription("second update");

        context.commitChanges();
    }
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        object.setDescription("second update");
        context.getObjectStore().getDataRowCache().forgetSnapshot(object.getObjectId());

        context.commitChanges();
    }
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        context.getObjectStore().getDataRowCache().forgetSnapshot(object.getObjectId());
        object.setDescription("second update");

        context.commitChanges();
    }
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected
        object.setDescription("first update");
        context.commitChanges();

        // change row underneath, change description and save... optimistic lock failure
        // expected
        createTestData("SimpleLockUpdate");
        object.setDescription("second update");

        try {
            context.commitChanges();
            fail("Optimistic lock failure expected.");
        }
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);

        // change description and save... no optimistic lock failure expected...
        object.setDescription("first update");
        context.commitChanges();

        // change row underneath, change description and save... optimistic lock failure
        // expected
        createTestData("SimpleLockUpdate");
        object.setDescription("second update");

        try {
            context.commitChanges();
            fail("Optimistic lock failure expected.");
        }
View Full Code Here

        query.addOrdering(new Ordering("db:LOCKING_TEST_ID", Ordering.ASC));

        List allObjects = context.performQuery(query);
        assertEquals(3, allObjects.size());

        SimpleLockingTestEntity object1 = (SimpleLockingTestEntity) allObjects.get(0);
        SimpleLockingTestEntity object2 = (SimpleLockingTestEntity) allObjects.get(1);
        SimpleLockingTestEntity object3 = (SimpleLockingTestEntity) allObjects.get(2);

        // change description and save... no optimistic lock failure expected...
        object1.setDescription("first update for object1");
        object2.setDescription("first update for object2");
        object3.setName("object3 - new name");
        context.commitChanges();

        // TODO: it would be nice to pick inside DataContext to see that 3 batches where
        // generated...
        // this requires refactoring of ContextCommit.
View Full Code Here

        // change name and save... no optimistic lock failure expected
        object.setName("first update");
        context.commitChanges();

        // change relationship and save... no optimistic lock failure expected
        SimpleLockingTestEntity object1 = context
                .newObject(SimpleLockingTestEntity.class);
        object.setToSimpleLockingTest(object1);
        context.commitChanges();

        // change row underneath, change description and save... optimistic lock failure
View Full Code Here

        List allObjects = context.performQuery(new SelectQuery(
                SimpleLockingTestEntity.class));
        assertEquals(1, allObjects.size());

        SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
        object.setDescription("first update");

        // change row underneath, change description and save... optimistic lock failure
        // expected
        createTestData("SimpleLockUpdate");
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.locking.SimpleLockingTestEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.