Package org.apache.cayenne.exp

Examples of org.apache.cayenne.exp.Expression


    }

    public void testSelectBooleanTrue() throws Exception {
        createArtistsDataSet();
        SelectQuery query = new SelectQuery(Artist.class);
        Expression qual = ExpressionFactory.expTrue();
        qual = qual.andExp(ExpressionFactory.matchExp("artistName", "artist1"));
        query.setQualifier(qual);
        List objects = context.performQuery(query);
        assertEquals(1, objects.size());
    }
View Full Code Here


    }

    public void testSelectBooleanNotTrueOr() throws Exception {
        createArtistsDataSet();
        SelectQuery query = new SelectQuery(Artist.class);
        Expression qual = ExpressionFactory.expTrue();
        qual = qual.notExp();
        qual = qual.orExp(ExpressionFactory.matchExp("artistName", "artist1"));
        query.setQualifier(qual);
        List objects = context.performQuery(query);
        assertEquals(1, objects.size());
    }
View Full Code Here

    }

    public void testSelectBooleanFalse() throws Exception {
        createArtistsDataSet();
        SelectQuery query = new SelectQuery(Artist.class);
        Expression qual = ExpressionFactory.expFalse();
        qual = qual.andExp(ExpressionFactory.matchExp("artistName", "artist1"));
        query.setQualifier(qual);
        List objects = context.performQuery(query);
        assertEquals(0, objects.size());
    }
View Full Code Here

    }

    public void testSelectBooleanFalseOr() throws Exception {
        createArtistsDataSet();
        SelectQuery query = new SelectQuery(Artist.class);
        Expression qual = ExpressionFactory.expFalse();
        qual = qual.orExp(ExpressionFactory.matchExp("artistName", "artist1"));
        query.setQualifier(qual);
        List objects = context.performQuery(query);
        assertEquals(1, objects.size());
    }
View Full Code Here

        ObjRelationship exhibitToArtistExhibitRel = (ObjRelationship) exhibitEntity
                .getRelationship("artistExhibitArray");
        exhibitEntity.removeRelationship("artistExhibitArray");

        Expression e = ExpressionFactory.matchExp("artistName", "artist1");
        SelectQuery q = new SelectQuery("Artist", e);
        q.addPrefetch("paintingArray");
        q.addPrefetch("paintingArray.toGallery");
        q.addPrefetch("artistExhibitArray.toExhibit");
View Full Code Here

     */
    public void testRouteQueryWithPrefetchesPrefetchExpressionPath() {

        // find the painting not matching the artist (this is the case where such prefetch
        // at least makes sense)
        Expression exp = ExpressionFactory.noMatchExp("toArtist", new Object());

        SelectQuery q = new SelectQuery(Painting.class, exp);
        q.addPrefetch("toArtist");

        // test how prefetches are resolved in this case - this was a stumbling block for
View Full Code Here

        createArtistWithPaintingDataSet();

        Artist a1 = Cayenne.objectForPK(context, Artist.class, 8);

        Expression e = ExpressionFactory.matchExp(ROPainting.TO_ARTIST_PROPERTY, a1);
        SelectQuery q = new SelectQuery(ROPainting.class, e);

        List<ROPainting> paints = context.performQuery(q);
        assertEquals(1, paints.size());
View Full Code Here

        createArtistWithPaintingDataSet();

        Artist a1 = Cayenne.objectForPK(context, Artist.class, 8);

        Expression e = ExpressionFactory.matchExp(ROPainting.TO_ARTIST_PROPERTY, a1);
        SelectQuery q = new SelectQuery(ROPainting.class, e);

        List<ROPainting> paints = context.performQuery(q);
        assertEquals(1, paints.size());
View Full Code Here

        createArtistWithPaintingDataSet();
        Artist a1 = Cayenne.objectForPK(context, Artist.class, 8);
        Painting p1 = Cayenne.objectForPK(context, Painting.class, 6);

        Expression e = ExpressionFactory.matchExp(Painting.TO_ARTIST_PROPERTY, a1);
        SelectQuery q = new SelectQuery(Painting.class, e);

        List<Painting> paints = context.performQuery(q);
        assertEquals(1, paints.size());
        assertSame(p1, paints.get(0));
View Full Code Here

        createArtistWithPaintingsInGalleryDataSet();

        Artist a1 = Cayenne.objectForPK(context, Artist.class, 8);
        Gallery g1 = Cayenne.objectForPK(context, Gallery.class, 11);

        Expression e = ExpressionFactory.matchExp("paintingArray.toGallery", g1);
        SelectQuery q = new SelectQuery("Artist", e);

        List<Artist> artists = context.performQuery(q);
        assertEquals(1, artists.size());
        assertSame(a1, artists.get(0));
View Full Code Here

TOP

Related Classes of org.apache.cayenne.exp.Expression

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.