Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataContext.commitChanges()


        a1.removeFromGroupArray(group); // Cause the delete of the link record

        context.deleteObject(a1); // Cause the deletion of the artist

        try {
            context.commitChanges();
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("Should not have thrown the exception :" + e.getMessage());
        }
View Full Code Here


        a1.addToGroupArray(group);
        group.removeFromArtistArray(a1);

        blockQueries();
        try {
            context.commitChanges();
        }
        finally {
            unblockQueries();
        }
    }
View Full Code Here

        // and then deleted AND there are some other changes (CAY-548)
        a1.removeFromGroupArray(g1);

        MockDataNode engine = MockDataNode.interceptNode(getDomain(), getNode());
        try {
            context.commitChanges();
            assertEquals(1, engine.getRunCount());
        }
        finally {
            engine.stopInterceptNode();
        }
View Full Code Here

        // *** TESTING THIS ***
        p1.setToArtist(a1);

        assertSame(a1, p1.getToArtist());

        context.commitChanges();
        ObjectId aid = a1.getObjectId();
        ObjectId pid = p1.getObjectId();
        context.invalidateObjects(Arrays.asList(a1, p1));

        Painting1 p2 = (Painting1) Cayenne.objectForPK(context, pid);
View Full Code Here

        DataContext context = createDataContext();

        DataObject g1 = (DataObject) context.newObject("Generic1");
        g1.writeProperty("name", "G1 Name");

        context.commitChanges();
    }

    public void testInsertRelated() {
        DataContext context = createDataContext();
View Full Code Here

        DataObject g2 = (DataObject) context.newObject("Generic2");
        g2.writeProperty("name", "G2 Name");
        g2.setToOneTarget("toGeneric1", g1, true);

        context.commitChanges();
    }

    public void testSelect() {
        DataContext context = createDataContext();
View Full Code Here

        DataObject g2 = (DataObject) context.newObject("Generic2");
        g2.writeProperty("name", "G2 Name");
        g2.setToOneTarget("toGeneric1", g1, true);

        context.commitChanges();

        List r1 = (List) g1.readProperty("generic2s");
        assertTrue(r1.contains(g2));

        DataObject g11 = (DataObject) context.newObject("Generic1");
View Full Code Here

        DataObject g11 = (DataObject) context.newObject("Generic1");
        g11.writeProperty("name", "G11 Name");
        g2.setToOneTarget("toGeneric1", g11, true);

        context.commitChanges();

        List r11 = (List) g11.readProperty("generic2s");
        assertTrue(r11.contains(g2));

        List r1_1 = (List) g1.readProperty("generic2s");
View Full Code Here

    public void testSerializeCommitted() throws Exception {
        DataContext context = super.createDataContext();

        Artist artist = (Artist) context.newObject("Artist");
        artist.setArtistName("artist1");
        context.commitChanges();

        assertEquals(PersistenceState.COMMITTED, artist.getPersistenceState());

        ObjectId id = artist.getObjectId();
        assertNotNull(id);
View Full Code Here

        object.setKey1(key1v1);
        object.setKey2(key2v1);
        object.setName("testing testing");

        context.commitChanges();
        assertEquals(key1v1, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v1, object.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.