Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.EJBQLQuery


                + " SELECT DISTINCT p1.paintingTitle FROM Painting p1"
                + " WHERE p1.paintingTitle = p.paintingTitle"
                + " AND p.estimatedPrice <> p1.estimatedPrice"
                + ")";

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

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


                + " WHERE p.estimatedPrice > ALL ("
                + " SELECT p1.estimatedPrice FROM Painting p1"
                + " WHERE p1.paintingTitle = 'P2'"
                + ")";

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

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

                + " WHERE p.estimatedPrice > ANY ("
                + " SELECT p1.estimatedPrice FROM Painting p1"
                + " WHERE p1.paintingTitle = 'P1'"
                + ")";

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

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

                + " WHERE p.estimatedPrice > SOME ("
                + " SELECT p1.estimatedPrice FROM Painting p1"
                + " WHERE p1.paintingTitle = 'P1'"
                + ")";

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

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

        a1.setArtistName("XX");
        context.commitChanges();
        assertEquals(0, a1.getPostLoaded());
        assertNull(listener.getPublicCalledbackEntity());

        EJBQLQuery q = new EJBQLQuery("select a, a.artistName from Artist a");
        context.performQuery(q);
        assertEquals(1, a1.getPostLoaded());
        assertSame(a1, listener.getPublicCalledbackEntity());
    }
View Full Code Here

        createFivePaintings();

        String ejbql = "SELECT p.estimatedPrice, count(p) FROM Painting p"
                + " GROUP BY p.estimatedPrice"
                + " ORDER BY p.estimatedPrice";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        List<?> data = context.performQuery(query);
        assertEquals(2, data.size());
        assertTrue(data.get(0) instanceof Object[]);
View Full Code Here

        createFivePaintings();

        String ejbql = "SELECT p.estimatedPrice, p.paintingTitle, count(p) FROM Painting p"
                + " GROUP BY p.estimatedPrice, p.paintingTitle"
                + " ORDER BY p.estimatedPrice, p.paintingTitle";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        List<?> data = context.performQuery(query);
        assertEquals(3, data.size());
        assertTrue(data.get(0) instanceof Object[]);
View Full Code Here

        createFourArtistsAndTwoPaintings();

        String ejbql = "SELECT COUNT(p), a, a.artistName "
                + "FROM Painting p INNER JOIN p.toArtist a GROUP BY a, a.artistName "
                + "ORDER BY a.artistName";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        List<?> data = context.performQuery(query);
        assertEquals(2, data.size());

        assertTrue(data.get(0) instanceof Object[]);
View Full Code Here

    public void testGroupByIdVariable() throws Exception {
        createFivePaintings();

        String ejbql = "SELECT count(p), p FROM Painting p GROUP BY p";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        List<?> data = context.performQuery(query);
        assertEquals(5, data.size());

        // TODO: andrus, 8/3/2007 the rest of the unit test fails as currently Cayenne
View Full Code Here

        createFivePaintings();

        String ejbql = "SELECT p.estimatedPrice, count(p) FROM Painting p"
                + " GROUP BY p.estimatedPrice"
                + " HAVING p.estimatedPrice > 1";
        EJBQLQuery query = new EJBQLQuery(ejbql);

        List<?> data = context.performQuery(query);
        assertEquals(1, data.size());
        assertTrue(data.get(0) instanceof Object[]);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.EJBQLQuery

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.