Package org.apache.openjpa.persistence.criteria.AbstractCriteriaTestCase

Examples of org.apache.openjpa.persistence.criteria.AbstractCriteriaTestCase.QueryDecorator


        Root<CompUser> c = cq.from(CompUser.class);
        ParameterExpression<String> param = cb.parameter(String.class, "name");
        cq.where(cb.like(c.get(CompUser_.name), param, '|'));
        cq.select(c.get(CompUser_.name));
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("name", "%|_%");
            }
        }, cq, query);
    }
View Full Code Here


        Parameter<Class> param1 = cb.parameter(Class.class, "a");
        Parameter<Class> param2 = cb.parameter(Class.class, "b");
        cq.where(e.type().in(param1, param2));
        cq.orderBy(cb.asc(e.get(CompUser_.name)));
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("a", MaleUser.class);
                q.setParameter("b", FemaleUser.class);
            }
        }, cq, jpql);
View Full Code Here

        Expression<Class<? extends CompUser>> etype = e.type();
        // how to specify the following
        q.multiselect(e.type());
        q.where(cb.equal(e.type(), param1).not());
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("t", MaleUser.class);
            }
        }, q, query);
    }
View Full Code Here

        Root<Customer> c = q.from(Customer.class);
        ParameterExpression<Integer> param = cb.parameter(Integer.class, "stat");
        param.alias("stat");
        q.select(c).where(cb.equal(c.get("status"), param));

        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("stat", 1);
            }
        }, q, jpql);
    }
View Full Code Here

        Root<CompUser> c = cq.from(CompUser.class);
        ParameterExpression<String> param = cb.parameter(String.class, "name");
        cq.where(cb.like(c.get(CompUser_.name), param, '|'));
        cq.select(c.get(CompUser_.name));
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("name", "%|_%");
            }
        }, cq, query);
    }
View Full Code Here

        Parameter<Class> param1 = cb.parameter(Class.class, "a");
        Parameter<Class> param2 = cb.parameter(Class.class, "b");
        cq.where(e.type().in(param1, param2));
        cq.orderBy(cb.asc(e.get(CompUser_.name)));
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("a", MaleUser.class);
                q.setParameter("b", FemaleUser.class);
            }
        }, cq, jpql);
View Full Code Here

        Expression<Class<? extends CompUser>> etype = e.type();
        // how to specify the following
        q.multiselect(e.type());
        q.where(cb.equal(e.type(), param1).not());
       
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("t", MaleUser.class);
            }
        }, q, query);
    }
View Full Code Here

        Predicate p2 = cb.equal(d.get(Dependent_.id).get(DependentId_.empid), sq);
        Predicate p3 = cb.greaterThan(d.get(Dependent_.id).get(DependentId_.effDate), minDate);
        Predicate p4 = cb.lessThan(d.get(Dependent_.id).get(DependentId_.effDate), maxDate);
       
        q.where(cb.and(cb.and(cb.and(p1, p2), p3), p4));
        assertEquivalence(new QueryDecorator() {
            public void decorate(Query q) {
                q.setParameter("empid",   101L);
                q.setParameter("minDate", new Date(100));
                q.setParameter("maxDate", new Date(100000));
            }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.criteria.AbstractCriteriaTestCase.QueryDecorator

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.