Examples of Painting


Examples of er.cayenne.example.persistent.Painting

    // Creating other objects
    Gallery metropolitan = objContext.newObject(Gallery.class);
    metropolitan.setName("Metropolitan Museum of Art");

    Painting girl = objContext.newObject(Painting.class);
    girl.setName("Girl Reading at a Table");

    Painting stein = objContext.newObject(Painting.class);
    stein.setName("Gertrude Stein");

    // connecting objects together via relationships
    picasso.addToPaintings(girl);
    picasso.addToPaintings(stein);

    girl.setGallery(metropolitan);
    stein.setGallery(metropolitan);

    // saving all the changes above
    objContext.commitChanges();
  }
View Full Code Here

Examples of org.apache.art.Painting

                listener,
                "publicCallback");

        Artist a1 = context.newObject(Artist.class);
        a1.setArtistName("XX");
        Painting p1 = context.newObject(Painting.class);
        p1.setToArtist(a1);
        p1.setPaintingTitle("XXX");
        context.commitChanges();

        // reset context and read related object
        context = createDataContext();

        SelectQuery q = new SelectQuery(Painting.class);
        p1 = (Painting) context.performQuery(q).get(0);

        // this should be a hollow object, so no callback just yet
        a1 = p1.getToArtist();
        assertEquals(PersistenceState.HOLLOW, a1.getPersistenceState());
        assertEquals(0, a1.getPostLoaded());
        assertNull(listener.getPublicCalledbackEntity());

        a1.getArtistName();
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

                // result is served from cache) used to throw an exception...

                List<Painting> cachedResult = context.performQuery(q);

                assertFalse(cachedResult.isEmpty());
                Painting p1 = cachedResult.get(0);

                Object toOnePrefetch = p1.readNestedProperty("toArtist");
                assertNotNull(toOnePrefetch);
                assertTrue(
                        "Expected Artist, got: " + toOnePrefetch.getClass().getName(),
                        toOnePrefetch instanceof Artist);
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

                // result is served from cache) used to throw an exception...

                List<Painting> cachedResult = context.performQuery(q);

                assertFalse(cachedResult.isEmpty());
                Painting p1 = cachedResult.get(0);

                Object toOnePrefetch = p1.readNestedProperty("toArtist");
                assertNotNull(toOnePrefetch);
                assertTrue(
                        "Expected Artist, got: " + toOnePrefetch.getClass().getName(),
                        toOnePrefetch instanceof Artist);
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

                assertFalse(((ValueHolder) list).isFault());
                assertTrue(list.size() > 0);

                Iterator children = list.iterator();
                while (children.hasNext()) {
                    Painting p = (Painting) children.next();
                    assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());

                    // make sure properties are not null..
                    assertNotNull(p.getPaintingTitle());
                }
            }
        }
        finally {
            unblockQueries();
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

        try {
            assertEquals(3, objects.size());

            Iterator it = objects.iterator();
            while (it.hasNext()) {
                Painting p = (Painting) it.next();
                Artist target = p.getToArtist();
                assertNotNull(target);
                assertEquals(PersistenceState.COMMITTED, target.getPersistenceState());
            }
        }
        finally {
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

            try {
                assertEquals(1, objects.size());

                Iterator it = objects.iterator();
                while (it.hasNext()) {
                    Painting p = (Painting) it.next();
                    Artist a = p.getToArtist();
                    assertNotNull(a);
                    assertNotNull(a.getDateOfBirth());
                    assertTrue(a.getDateOfBirth().getClass().getName(), Date.class
                            .isAssignableFrom(a.getDateOfBirth().getClass()));
                }
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

                assertNotNull(list);
                assertFalse(((ValueHolder) list).isFault());

                Iterator children = list.iterator();
                while (children.hasNext()) {
                    Painting p = (Painting) children.next();
                    assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());
                    // make sure properties are not null..
                    assertNotNull(p.getPaintingTitle());
                }
            }
        }
        finally {
            unblockQueries();
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

            assertFalse(((ValueHolder) list).isFault());
            assertEquals(2, list.size());

            Iterator children = list.iterator();
            while (children.hasNext()) {
                Painting p = (Painting) children.next();
                assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());
                // make sure properties are not null..
                assertNotNull(p.getPaintingTitle());
            }

            // assert no duplicates
            Set s = new HashSet(list);
            assertEquals(s.size(), list.size());
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.Painting

        SelectQuery q = new SelectQuery(Painting.class);
        q.addOrdering("db:PAINTING_ID", SortOrder.ASCENDING);
        List paints = context.performQuery(q);

        Painting p1 = (Painting) paints.get(0);
        Painting p2 = (Painting) paints.get(1);

        Artist a1 = p1.getToArtist();
        assertSame(a1, p2.getToArtist());

        assertNotNull(context
                .getParentDataDomain()
                .getSharedSnapshotCache()
                .getCachedSnapshot(p1.getObjectId()));
        assertNotNull(context
                .getParentDataDomain()
                .getSharedSnapshotCache()
                .getCachedSnapshot(p2.getObjectId()));

        createTestData("testRefreshCollectionToOneUpdate");

        RefreshQuery refresh = new RefreshQuery(paints);
        context.performQuery(refresh);

        assertNull(context
                .getParentDataDomain()
                .getSharedSnapshotCache()
                .getCachedSnapshot(p1.getObjectId()));
        assertNull(context
                .getParentDataDomain()
                .getSharedSnapshotCache()
                .getCachedSnapshot(p2.getObjectId()));

        assertEquals(PersistenceState.HOLLOW, p1.getPersistenceState());
        assertEquals(PersistenceState.HOLLOW, p2.getPersistenceState());

        assertNotSame(a1, p1.getToArtist());
        assertNotSame(a1, p2.getToArtist());
        assertEquals("b", p1.getToArtist().getArtistName());
    }
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.