Package org.apache.cayenne

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


        String ejbql = "select e from CompoundFkTestEntity e WHERE e.toCompoundPk <> :param";
        EJBQLQuery query = new EJBQLQuery(ejbql);
        query.setParameter("param", a);

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

        CompoundFkTestEntity o1 = (CompoundFkTestEntity) ps.get(0);
        assertEquals(33001, DataObjectUtils.intPKForObject(o1));
    }
View Full Code Here


                query.getMetaData(child1.getEntityResolver())));

        assertNull(context.getQueryCache().get(
                query.getMetaData(context.getEntityResolver())));

        List<?> results = child1.performQuery(query);
        assertSame(results, ((BaseContext) child1).getQueryCache().get(
                query.getMetaData(child1.getEntityResolver())));

        assertNull(context.getQueryCache().get(
                query.getMetaData(context.getEntityResolver())));
View Full Code Here

    public void testJoinToJoined() {
        ObjectContext context = createDataContext();
       
        EJBQLQuery query = new EJBQLQuery(
            "select g from Gallery g inner join g.paintingArray p where p.toArtist.artistName like '%a%'");
        context.performQuery(query);
    }
   
    //test for CAY-1313
    public void testRelationshipWhereClauseAndToEJBQL() throws Exception {
        ObjectContext context = createDataContext();
View Full Code Here

        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

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

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

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

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

        UUID id = UUID.randomUUID();
        test.setUuid(id);
        context.commitChanges();

        SelectQuery q = new SelectQuery(UuidTestEntity.class);
        UuidTestEntity testRead = (UuidTestEntity) context.performQuery(q).get(0);
        assertNotNull(testRead.getUuid());
        assertEquals(id, testRead.getUuid());

        test.setUuid(null);
        context.commitChanges();
View Full Code Here

        createTestData("prepareCollection");

        ObjectContext context = createDataContext();

        SelectQuery q = new SelectQuery(Artist.class);
        List<Artist> allArtists = context.performQuery(q);

        Date dob = new Date();
        allArtists.get(0).setDateOfBirth(dob);
        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.