Package org.apache.cayenne

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


        Master altA1 = (Master) parentContext2.localObject(altA.getObjectId(), null);

        final ObjectContext childContext1 = parentContext1.createChildContext();
        final Child p2 = (Child) childContext1.localObject(p.getObjectId(), p);
        final Master altA2 = (Master) childContext1.localObject(altA.getObjectId(), altA);
        Master a2 = (Master) childContext1.localObject(a.getObjectId(), a);

        p1.setMaster(altA1);
        assertSame(a2, p2.getMaster());
        assertNotSame(altA2, p2.getMaster());
        parentContext2.commitChanges();
View Full Code Here


        Child py1 = (Child) parentContext2.localObject(py.getObjectId(), py);
        Master a1 = (Master) parentContext2.localObject(a.getObjectId(), a);

        final ObjectContext peer2 = parentContext1.createChildContext();
        final Child py2 = (Child) peer2.localObject(py.getObjectId(), py);
        final Master a2 = (Master) peer2.localObject(a.getObjectId(), a);

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

        Child py1 = (Child) parentContext2.localObject(py.getObjectId(), py);
        Master a1 = (Master) parentContext2.localObject(a.getObjectId(), a);

        final ObjectContext peer2 = parentContext1.createChildContext();
        final Child py2 = (Child) peer2.localObject(py.getObjectId(), py);
        final Master a2 = (Master) peer2.localObject(a.getObjectId(), a);

        a1.addToChildren(py1);
        assertEquals(1, a2.getChildren().size());
        assertFalse(a2.getChildren().contains(py2));
        parentContext2.commitChangesToParent();
View Full Code Here

        Artist a1 = peer1.newObject(Artist.class);
        a1.setArtistName("Y");
        ObjectId a1TempId = a1.getObjectId();

        ObjectContext peer2 = context.createChildContext();
        Artist a2 = (Artist) peer2.localObject(a1TempId, a1);

        assertEquals(a1TempId, a2.getObjectId());

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

        Artist a = context.newObject(Artist.class);
        a.setArtistName("X");
        context.commitChanges();

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

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

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

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

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

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

        a.setArtistName("X");
        altA.setArtistName("Y");
        context.commitChanges();

        ObjectContext peer1 = context.createChildContext();
        Painting p1 = (Painting) peer1.localObject(p.getObjectId(), p);
        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);
View Full Code Here

        altA.setArtistName("Y");
        context.commitChanges();

        ObjectContext peer1 = context.createChildContext();
        Painting p1 = (Painting) peer1.localObject(p.getObjectId(), p);
        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);
View Full Code Here

        ObjectContext peer1 = context.createChildContext();
        Painting p1 = (Painting) peer1.localObject(p.getObjectId(), p);
        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());
View Full Code Here

        Painting p1 = (Painting) peer1.localObject(p.getObjectId(), p);
        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();
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.