Package org.apache.art

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


                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);
        q.addPrefetch(Painting.TO_ARTIST_PROPERTY);
        p1 = (Painting) context.performQuery(q).get(0);

        // artist is prefetched here, and a callback must have been invoked
        a1 = p1.getToArtist();
        assertEquals(PersistenceState.COMMITTED, a1.getPersistenceState());
        assertEquals(1, a1.getPostLoaded());
        assertSame(a1, listener.getPublicCalledbackEntity());
    }
View Full Code Here

    public void testMultipleToOneDeletion() throws Exception {
        deleteTestData();

        ObjectContext context = createDataContext();

        Painting p = context.newObject(Painting.class);
        p.setPaintingTitle("P1");

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

        Gallery g = context.newObject(Gallery.class);
        g.setGalleryName("G1");

        p.setToArtist(a);
        p.setToGallery(g);
        context.commitChanges();

        p.setToArtist(null);
        p.setToGallery(null);

        context.commitChanges();

        SQLTemplate q = new SQLTemplate(Painting.class, "SELECT * from PAINTING");
        q.setColumnNamesCapitalization(CapsStrategy.UPPER);
View Full Code Here

        query.setParameters(Collections.singletonMap("a", a));

        List objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Painting p = (Painting) objects.get(0);
        assertEquals(33002, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        // null comparison is unpredictable across DB's ... some would return true on null
        // <> value, some - false
        assertTrue(objects.size() == 1 || objects.size() == 2);

        Painting p = (Painting) objects.get(0);
        assertEquals(33001, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        query.setParameters(Collections.singletonMap("a", a));

        List objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Painting p = (Painting) objects.get(0);
        assertEquals(33002, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        query.setParameters(Collections.singletonMap("a", a));

        List objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Painting p = (Painting) objects.get(0);
        assertEquals(33002, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        query.setParameters(Collections.singletonMap("a", null));

        List objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Painting p = (Painting) objects.get(0);
        assertEquals(33003, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        List objects = context.performQuery(query);
        // null comparison is unpredictable across DB's ... some would return true on null
        // <> value, some - false
        assertTrue(objects.size() == 1 || objects.size() == 2);

        Painting p = (Painting) objects.get(0);
        assertEquals(33001, DataObjectUtils.intPKForObject(p));
    }
View Full Code Here

        query.setParameters(Collections.singletonMap("a", null));

        List objects = context.performQuery(query);
        assertEquals(2, objects.size());

        Painting p1 = (Painting) objects.get(0);
        assertEquals(33001, DataObjectUtils.intPKForObject(p1));

        Painting p2 = (Painting) objects.get(1);
        assertEquals(33002, DataObjectUtils.intPKForObject(p2));
    }
View Full Code Here

TOP

Related Classes of org.apache.art.Painting

Copyright © 2018 www.massapicom. 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.