Package org.apache.cayenne.testdo.testmap

Examples of org.apache.cayenne.testdo.testmap.Artist.addToPaintingArray()


        Artist a1 = context.newObject(Artist.class);
        a1.setArtistName("XyzQ");

        Painting p01 = context.newObject(Painting.class);
        p01.setPaintingTitle("1");
        a1.addToPaintingArray(p01);

        Painting p02 = context.newObject(Painting.class);
        p02.setPaintingTitle("2");
        a1.addToPaintingArray(p02);
View Full Code Here


        p01.setPaintingTitle("1");
        a1.addToPaintingArray(p01);

        Painting p02 = context.newObject(Painting.class);
        p02.setPaintingTitle("2");
        a1.addToPaintingArray(p02);

        context.commitChanges();

        ObjectContext context2 = runtime.newContext();
View Full Code Here

        assertNull(painting.getToArtist()); // Make sure it wasn't set

        // Now try the reverse (toMany) relationship
        try {
            artist.addToPaintingArray(painting);
            fail("Should have failed to add a cross-context relationship");
        }
        catch (CayenneRuntimeException e) {
            // Fine.. it should throw an exception
        }
View Full Code Here

        context.commitChanges();

        // Cause an update and an insert that need correct ordering
        Painting painting = context.newObject(Painting.class);
        painting.setPaintingTitle("a painting");
        artist.addToPaintingArray(painting);

        context.commitChanges();

        context.deleteObjects(artist);
        context.commitChanges();
View Full Code Here

        Painting p = context.newObject(Painting.class);
        p.setPaintingTitle("A Painting");
        // converting double to string prevents rounding weirdness...
        p.setEstimatedPrice(new BigDecimal("" + paintingPrice));
        a.addToPaintingArray(p);

        context.commitChanges();
    }

    /**
 
View Full Code Here

        ObjectContext childContext = runtime.newContext(context);

        Artist a = Cayenne.objectForPK(childContext, Artist.class, 33001);
        Painting p = childContext.newObject(Painting.class);
        p.setPaintingTitle("X");
        a.addToPaintingArray(p);

        childContext.commitChangesToParent();

        childContext.deleteObjects(p);
        a.removeFromPaintingArray(p);
View Full Code Here

        final Artist childModifiedToMany = ((Painting) objects.get(2)).getToArtist();

        // ensure painting array is fully resolved...
        childModifiedToMany.getPaintingArray().size();
        childModifiedToMany.addToPaintingArray((Painting) objects.get(3));

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                Painting parentModifiedSimple = null;
View Full Code Here

        a.setArtistName("X");
        child.commitChanges();

        Painting p1 = child.newObject(Painting.class);
        p1.setPaintingTitle("P1");
        a.addToPaintingArray(p1);

        Painting p2 = child.newObject(Painting.class);
        p2.setPaintingTitle("P2");
        a.addToPaintingArray(p2);
View Full Code Here

        p1.setPaintingTitle("P1");
        a.addToPaintingArray(p1);

        Painting p2 = child.newObject(Painting.class);
        p2.setPaintingTitle("P2");
        a.addToPaintingArray(p2);

        a.removeFromPaintingArray(p2);

        // this causes an error on commit
        child.deleteObjects(p2);
View Full Code Here

        Painting p = context.newObject(Painting.class);
        p.setPaintingTitle("A Painting");
        // converting double to string prevents rounding weirdness...
        p.setEstimatedPrice(new BigDecimal("" + paintingPrice));
        a.addToPaintingArray(p);

        context.commitChanges();
    }

    /**
 
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.