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()

     */
    public void testFailOnMissingParams() {
        Expression e1 = Expression.fromString("k1 = $test or k2 = 'v2' or k3 = 'v3'");

        try {
            e1.expWithParameters(Collections.EMPTY_MAP, false);
            fail("Parameter was missing, but no exception was thrown.");
        }
        catch (ExpressionException ex) {
            // exception expected
        }
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<Painting> select3 = SelectQuery.query(Painting.class, qualifier3);
        List<Painting> paintings3 = context.select(select3);
    }

    static void deleteTutorial(ObjectContext context) {
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<Painting> paintings3 = context.performQuery(select3);
  }
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<Painting> paintings3 = context.performQuery(select3);
  }
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 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 {

        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 galleries = context.performQuery(q);
View Full Code Here

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

    }

    public void testMixedPrefetch1() {

        Expression e = Expression.fromString("galleryName = $name");
        SelectQuery q = new SelectQuery(Gallery.class, e.expWithParameters(Collections
                .singletonMap("name", "gallery2")));
        q.addPrefetch("exhibitArray").setSemantics(
                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
        q.addPrefetch("exhibitArray.artistExhibitArray");
View Full Code Here

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

    }

    public void testMixedPrefetch2() {

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

        // reverse the order of prefetches compared to the previous test
        q.addPrefetch("exhibitArray");
        q.addPrefetch("exhibitArray.artistExhibitArray").setSemantics(
View Full Code Here

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

        Map params = new HashMap();
        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("paintingArray");

        List artists = context.performQuery(q);

        blockQueries();
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.