Package org.apache.cayenne

Examples of org.apache.cayenne.ObjectContext.localObject()


        Artist altA1 = (Artist) peer1.localObject(altA.getObjectId(), altA);

        ObjectContext peer2 = context.createChildContext();
        Painting p2 = (Painting) peer2.localObject(p.getObjectId(), p);
        Artist altA2 = (Artist) peer2.localObject(altA.getObjectId(), altA);
        Artist a2 = (Artist) peer2.localObject(a.getObjectId(), a);

        p1.setToArtist(altA1);
        assertSame(a2, p2.getToArtist());
        peer1.commitChangesToParent();
        assertEquals(altA2, p2.getToArtist());
View Full Code Here


        py.setPaintingTitle("PY");

        context.commitChanges();

        ObjectContext peer1 = context.createChildContext();
        Painting py1 = (Painting) peer1.localObject(py.getObjectId(), py);
        Artist a1 = (Artist) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = context.createChildContext();
        Painting py2 = (Painting) peer2.localObject(py.getObjectId(), py);
        Artist a2 = (Artist) peer2.localObject(a.getObjectId(), a);
View Full Code Here

        context.commitChanges();

        ObjectContext peer1 = context.createChildContext();
        Painting py1 = (Painting) peer1.localObject(py.getObjectId(), py);
        Artist a1 = (Artist) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = context.createChildContext();
        Painting py2 = (Painting) peer2.localObject(py.getObjectId(), py);
        Artist a2 = (Artist) peer2.localObject(a.getObjectId(), a);
View Full Code Here

        ObjectContext peer1 = context.createChildContext();
        Painting py1 = (Painting) peer1.localObject(py.getObjectId(), py);
        Artist a1 = (Artist) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = context.createChildContext();
        Painting py2 = (Painting) peer2.localObject(py.getObjectId(), py);
        Artist a2 = (Artist) peer2.localObject(a.getObjectId(), a);

        a1.addToPaintingArray(py1);
        assertEquals(1, a2.getPaintingArray().size());
        assertFalse(a2.getPaintingArray().contains(py2));
View Full Code Here

        Painting py1 = (Painting) peer1.localObject(py.getObjectId(), py);
        Artist a1 = (Artist) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = context.createChildContext();
        Painting py2 = (Painting) peer2.localObject(py.getObjectId(), py);
        Artist a2 = (Artist) peer2.localObject(a.getObjectId(), a);

        a1.addToPaintingArray(py1);
        assertEquals(1, a2.getPaintingArray().size());
        assertFalse(a2.getPaintingArray().contains(py2));
        peer1.commitChangesToParent();
View Full Code Here

        ObjectContext child = context.createChildContext();

        Painting painting = child.newObject(Painting.class);
        painting.setPaintingTitle("222");

        Artist localParentMt = (Artist) child.localObject(artist.getObjectId(), null);
        assertEquals(0, artist.getPaintingArray().size());
        assertEquals(0, localParentMt.getPaintingArray().size());

        painting.setToArtist(localParentMt);
View Full Code Here

        ClientMtTable1 a1 = peer1.newObject(ClientMtTable1.class);
        a1.setGlobalAttribute1("Y");
        ObjectId a1TempId = a1.getObjectId();

        ObjectContext peer2 = clientContext.createChildContext();
        ClientMtTable1 a2 = (ClientMtTable1) peer2.localObject(a1TempId, a1);

        assertEquals(a1TempId, a2.getObjectId());

        peer1.commitChanges();
        assertFalse(a1.getObjectId().isTemporary());
View Full Code Here

        ClientMtTable1 a = clientContext.newObject(ClientMtTable1.class);
        a.setGlobalAttribute1("X");
        clientContext.commitChanges();

        ObjectContext peer1 = clientContext.createChildContext();
        ClientMtTable1 a1 = (ClientMtTable1) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = clientContext.createChildContext();
        ClientMtTable1 a2 = (ClientMtTable1) peer2.localObject(a.getObjectId(), a);

        a1.setGlobalAttribute1("Y");
View Full Code Here

        ObjectContext peer1 = clientContext.createChildContext();
        ClientMtTable1 a1 = (ClientMtTable1) peer1.localObject(a.getObjectId(), a);

        ObjectContext peer2 = clientContext.createChildContext();
        ClientMtTable1 a2 = (ClientMtTable1) peer2.localObject(a.getObjectId(), a);

        a1.setGlobalAttribute1("Y");
        assertEquals("X", a2.getGlobalAttribute1());
        peer1.commitChangesToParent();
        assertEquals("Y", a2.getGlobalAttribute1());
View Full Code Here

        a.setGlobalAttribute1("X");
        altA.setGlobalAttribute1("Y");
        clientContext.commitChanges();

        ObjectContext peer1 = clientContext.createChildContext();
        ClientMtTable2 p1 = (ClientMtTable2) peer1.localObject(p.getObjectId(), p);
        ClientMtTable1 altA1 = (ClientMtTable1) peer1.localObject(altA.getObjectId(), altA);

        ObjectContext peer2 = clientContext.createChildContext();
        ClientMtTable2 p2 = (ClientMtTable2) peer2.localObject(p.getObjectId(), p);
        ClientMtTable1 altA2 = (ClientMtTable1) peer2.localObject(altA.getObjectId(), altA);
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.