Examples of performQuery()


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

                + " WHERE m NOT MEMBER d.employees";

        ObjectContext context = createDataContext();

        EJBQLQuery query = new EJBQLQuery(ejbql);
        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());

        Set<String> ids = new HashSet<String>();
        Iterator<?> it = objects.iterator();
        while (it.hasNext()) {
View Full Code Here

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

                + " WHERE m NOT MEMBER d.employees";

        ObjectContext context = createDataContext();

        EJBQLQuery query = new EJBQLQuery(ejbql);
        List<?> objects = context.performQuery(query);
        assertEquals(0, objects.size());
    }
}
View Full Code Here

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

        ObjectContext childContext = context.createChildContext();

        // make sure we fetch in predictable order
        SelectQuery query = new SelectQuery(Painting.class);
        query.addOrdering(Painting.PAINTING_TITLE_PROPERTY, SortOrder.ASCENDING);
        List objects = childContext.performQuery(query);

        assertEquals(6, objects.size());

        Painting childModifiedSimple = (Painting) objects.get(0);
        childModifiedSimple.setPaintingTitle("C_PT");
View Full Code Here

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

        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
                        "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) VALUES (1, 1, 'p1')"));

        context.performQuery(chain);

        Painting p = Cayenne.objectForPK(context, Painting.class, 1);

        // resolve artist once before running non-refreshing query, to check that we do
        // not refresh the object
View Full Code Here

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

        Artist a = Cayenne.objectForPK(context, Artist.class, 1);
        long v = a.getSnapshotVersion();
        int writeCalls = a.getPropertyWrittenDirectly();
        assertEquals("a1", a.getArtistName());

        context.performQuery(new SQLTemplate(
                Artist.class,
                "UPDATE ARTIST SET ARTIST_NAME = 'a2' WHERE ARTIST_ID = 1"));

        RelationshipQuery toOne = new RelationshipQuery(
                p.getObjectId(),
View Full Code Here

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

        RelationshipQuery toOne = new RelationshipQuery(
                p.getObjectId(),
                Painting.TO_ARTIST_PROPERTY,
                false);

        List<Artist> related = context.performQuery(toOne);
        assertEquals(1, related.size());
        assertTrue(related.contains(a));
        assertEquals("a1", a.getArtistName());
        assertEquals(v, a.getSnapshotVersion());
        assertEquals(
View Full Code Here

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

        chain
                .addQuery(new SQLTemplate(
                        Painting.class,
                        "INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) VALUES (1, 1, 'p1')"));

        context.performQuery(chain);

        Painting p = Cayenne.objectForPK(context, Painting.class, 1);

        // resolve artist once before running non-refreshing query, to check that we do
        // not refresh the object
View Full Code Here

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

        Artist a = Cayenne.objectForPK(context, Artist.class, 1);
        long v = a.getSnapshotVersion();
        int writeCalls = a.getPropertyWrittenDirectly();
        assertEquals("a1", a.getArtistName());

        context.performQuery(new SQLTemplate(
                Artist.class,
                "UPDATE ARTIST SET ARTIST_NAME = 'a2' WHERE ARTIST_ID = 1"));

        RelationshipQuery toOne = new RelationshipQuery(
                p.getObjectId(),
View Full Code Here

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

        RelationshipQuery toOne = new RelationshipQuery(
                p.getObjectId(),
                Painting.TO_ARTIST_PROPERTY,
                true);

        List<Artist> related = context.performQuery(toOne);
        assertEquals(1, related.size());
        assertTrue(related.contains(a));
        assertEquals("a2", a.getArtistName());
        assertTrue("Looks like relationship query didn't cause a snapshot refresh", v < a
                .getSnapshotVersion());
View Full Code Here

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

        SelectQuery query = new SelectQuery(Artist.class);
        query.andQualifier(ExpressionFactory.matchExp("p.paintingTitle", "X"));

        query.aliasPathSplits("paintingArray", "p");

        List<Artist> artists = context.performQuery(query);
        assertEquals(1, artists.size());
        assertEquals("AA", artists.get(0).getArtistName());
    }

    public void testAliasPathSplits_SplitJoin() {
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.