Package org.apache.cayenne.access

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


        assertEquals(dao.getObjectId(), refreshedDao.getObjectId());

        dao.setKey1(key1v3);
        dao.setKey2(key2v3);

        context.commitChanges();
        assertEquals(key1v3, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY1_PK_COLUMN));
        assertEquals(key2v3, dao.getObjectId().getIdSnapshot().get(
                CompoundPkTestEntity.KEY2_PK_COLUMN));
View Full Code Here


        parentGroup.setName("parent");

        ArtGroup childGroup1 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup1.setName("child1");
        childGroup1.setToParentGroup(parentGroup);
        dc.commitChanges();
    }

    public void testReflexiveRelationshipInsertOrder2() {
        // Create in a different order and see what happens
        DataContext dc = this.createDataContext();
View Full Code Here

        ArtGroup parentGroup = (ArtGroup) dc.newObject("ArtGroup");
        parentGroup.setName("parent");

        childGroup1.setToParentGroup(parentGroup);

        dc.commitChanges();
    }

    public void testReflexiveRelationshipInsertOrder3() {
        // Tey multiple children, one created before parent, one after
        DataContext dc = this.createDataContext();
View Full Code Here

        ArtGroup childGroup2 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup2.setName("child2");
        childGroup2.setToParentGroup(parentGroup);

        dc.commitChanges();
    }

    public void testReflexiveRelationshipInsertOrder4() {
        // Tey multiple children, one created before parent, one after
        DataContext dc = this.createDataContext();
View Full Code Here

        ArtGroup childGroup2 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup2.setName("subchild");
        childGroup2.setToParentGroup(childGroup1);

        dc.commitChanges();
    }

    public void testCrossContextRelationshipException() {
        DataContext otherContext = getDomain().createDataContext();
        // Create this object in one context...
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) DataObjectUtils.objectForPK(context, pid);
View Full Code Here

        // this should go away when such mapping becomes fully supported
        target.setDepId(new Integer(1));
        target.setRoot2(src2);

        src.addToDeps(target);
        context.commitChanges();

        context.invalidateObjects(Arrays.asList(src, target, src2));

        ToManyFkRoot src1 = (ToManyFkRoot) DataObjectUtils.objectForPK(context, src
                .getObjectId());
View Full Code Here

        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

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.