Examples of expWithParameters()


Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("name1", "artist2");
        params.put("name2", "artist3");
        Expression e = Expression.fromString("artistName = $name1 or artistName = $name2");
        SelectQuery q = new SelectQuery("Artist", e.expWithParameters(params));
        q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY);

        final List<Artist> artists = context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

    Calendar c = new GregorianCalendar();
    c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);

    Expression qualifier3 = Expression
        .fromString("artist.dateOfBirth < $date");
    qualifier3 = qualifier3.expWithParameters(Collections.singletonMap(
        "date", c.getTime()));
    SelectQuery select3 = new SelectQuery(Painting.class, qualifier3);
    List paintings3 = context.performQuery(select3);
  }
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        Expression qualifier = Expression.fromString("db:"
                + DBConnectionInfo.ID_PK_COLUMN
                + " in $ids");
        Map params = Collections.singletonMap("ids", ids);
        SelectQuery query = new SelectQuery(DBConnectionInfo.class, qualifier
                .expWithParameters(params));

        // narrow down the results to just DBConnectionInfo
        List connectionData = context.performQuery(query);
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        DbEntity entity = context.getEntityResolver().lookupDbEntity(javaClass);
        DbAttribute pk = (DbAttribute) entity.getPrimaryKey().get(0);

        Expression qualifier = Expression.fromString("db:" + pk.getName() + " in $ids");
        Map params = Collections.singletonMap("ids", ids);
        SelectQuery query = new SelectQuery(javaClass, qualifier
                .expWithParameters(params));
        return context.performQuery(query);
    }

    /**
 
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        // select all paintings done by artists who were born more than a 100 years ago
        Calendar c = new GregorianCalendar();
        c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);

        Expression qualifier3 = Expression.fromString("artist.dateOfBirth < $date");
        qualifier3 = qualifier3.expWithParameters(Collections.singletonMap("date", c
                .getTime()));
        SelectQuery select3 = new SelectQuery(Painting.class, qualifier3);
        List paintings3 = context.performQuery(select3);
    }
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        DbEntity entity = context.getEntityResolver().lookupDbEntity(javaClass);
        DbAttribute pk = entity.getPrimaryKeys().iterator().next();

        Expression qualifier = Expression.fromString("db:" + pk.getName() + " in $ids");
        Map params = Collections.singletonMap("ids", ids);
        SelectQuery query = new SelectQuery(javaClass, qualifier
                .expWithParameters(params));
        return context.performQuery(query);
    }

    /**
 
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        Expression qualifier = Expression.fromString("db:"
                + DBConnectionInfo.ID_PK_COLUMN
                + " in $ids");
        Map params = Collections.singletonMap("ids", ids);
        SelectQuery query = new SelectQuery(DBConnectionInfo.class, qualifier
                .expWithParameters(params));

        // narrow down the results to just DBConnectionInfo
        List connectionData = context.performQuery(query);
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("name1", "artist2");
        params.put("name2", "artist3");
        Expression e = Expression
                .fromString("artistName = $name1 or artistName = $name2");
        SelectQuery q = new SelectQuery("Artist", e.expWithParameters(params));
        q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY);

        final List<Artist> artists = context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
View Full Code Here

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

        assertNull(context.getGraphManager().getNode(oid1));
        assertNull(context.getGraphManager().getNode(oid2));

        Expression e = Expression.fromString("galleryName = $name");
        SelectQuery q = new SelectQuery(Gallery.class, e.expWithParameters(Collections
                .singletonMap("name", "gallery2")));
        q.addPrefetch("exhibitArray.artistExhibitArray");

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

Examples of org.apache.cayenne.exp.Expression.expWithParameters()

    public void testToManyToManyFirstStepResolved() throws Exception {

        createTwoArtistsWithExhibitsDataSet();

        Expression e = Expression.fromString("galleryName = $name");
        SelectQuery q = new SelectQuery(Gallery.class, e.expWithParameters(Collections
                .singletonMap("name", "gallery2")));
        q.addPrefetch("exhibitArray");
        q.addPrefetch("exhibitArray.artistExhibitArray");

        List<Gallery> galleries = context.performQuery(q);
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.