Examples of performQuery()


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

        EJBQLQuery query = new EJBQLQuery(
            "select p from Painting p where p.toArtist=:a");
        query.setParameter("a", a);

        List<Painting> paintings = context.performQuery(query);
        assertEquals(1, paintings.size());
        assertSame(p, paintings.get(0));
    }

    public void testRelationshipWhereClause2() throws Exception {
View Full Code Here

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

        ObjectContext context = createDataContext();

        Expression exp = ExpressionFactory.matchExp(Painting.TO_GALLERY_PROPERTY, null);
        EJBQLQuery query = new EJBQLQuery("select p.toArtist from Painting p where " + exp.toEJBQL("p"));

        context.performQuery(query);
    }

    public void testOrBrackets() throws Exception {
        deleteTestData();
        ObjectContext context = createDataContext();
View Full Code Here

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

        //this query is equivalent to (false and (false or true)) and
        //should always return 0 rows
        EJBQLQuery query = new EJBQLQuery("select a from Artist a " +
        "where a.artistName <> a.artistName and " +
        "(a.artistName <> a.artistName or a.artistName = a.artistName)");
        assertEquals(context.performQuery(query).size(), 0);

        //on the other hand, the following is equivalent to (false and false) or true) and
        //should return >0 rows
        query = new EJBQLQuery("select a from Artist a " +
            "where a.artistName <> a.artistName and " +
View Full Code Here

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

        //on the other hand, the following is equivalent to (false and false) or true) and
        //should return >0 rows
        query = new EJBQLQuery("select a from Artist a " +
            "where a.artistName <> a.artistName and " +
            "a.artistName <> a.artistName or a.artistName = a.artistName");
        assertTrue(context.performQuery(query).size() > 0);

        //checking brackets around not
        query = new EJBQLQuery("select a from Artist a " +
            "where not(a.artistName <> a.artistName and " +
            "a.artistName <> a.artistName or a.artistName = a.artistName)");
View Full Code Here

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

        //checking brackets around not
        query = new EJBQLQuery("select a from Artist a " +
            "where not(a.artistName <> a.artistName and " +
            "a.artistName <> a.artistName or a.artistName = a.artistName)");
        assertEquals(context.performQuery(query).size(), 0);

        //not is first to process
        query = new EJBQLQuery("select a from Artist a " +
                "where not a.artistName <> a.artistName or " +
                "a.artistName = a.artistName");
View Full Code Here

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

        //not is first to process
        query = new EJBQLQuery("select a from Artist a " +
                "where not a.artistName <> a.artistName or " +
                "a.artistName = a.artistName");
        assertTrue(context.performQuery(query).size() > 0);
    }
}
View Full Code Here

Examples of org.apache.cayenne.access.DataContext.performQuery()

           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(1, context.performQuery(query).size());
                   
                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
                    assertEquals(0, context.performQuery(query).size());
                }
            }.assertWithTimeout(200);
View Full Code Here

Examples of org.apache.cayenne.access.DataContext.performQuery()

                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(1, context.performQuery(query).size());
                   
                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
                    assertEquals(0, context.performQuery(query).size());
                }
            }.assertWithTimeout(200);
           
            context.deleteObject(test);
            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
View Full Code Here

Examples of org.apache.cayenne.access.DataContext.performQuery()

           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(0, context.performQuery(query).size());
                   
                    SQLTemplate template = new SQLTemplate(entity, "SELECT * FROM SOFT_TEST");
                    template.setFetchingDataRows(true);
                    assertEquals(1, context.performQuery(template).size());
                }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext.performQuery()

                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(0, context.performQuery(query).size());
                   
                    SQLTemplate template = new SQLTemplate(entity, "SELECT * FROM SOFT_TEST");
                    template.setFetchingDataRows(true);
                    assertEquals(1, context.performQuery(template).size());
                }
            }.assertWithTimeout(200);
        }
        finally {
            context.performQuery(new SQLTemplate(entity, "DELETE FROM SOFT_TEST"));
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.