Package org.apache.openjpa.persistence.query

Examples of org.apache.openjpa.persistence.query.DomainObject.select()


    }
   
    public void testGeneralCase() {
        DomainObject e = qb.createQueryDefinition(Employee.class);
        e.where(e.get("department").get("name").equal("Engineering"));
        e.select(e.get("name"),
        e.generalCase()
        .when(e.get("rating").equal(1))
        .then(e.get("salary").times(1.1))
        .when(e.get("rating").equal(2))
        .then(e.get("salary").times(1.2))
View Full Code Here


   
    public void testCreateSubquery() {
        DomainObject customer = qb.createQueryDefinition(Customer.class);
        DomainObject order =
            qb.createSubqueryDefinition(customer.get("orders"));
        customer.where(order.select(order.get("cost").avg()).greaterThan(100));
       
        String jpql = "SELECT c "
                    + " FROM Customer c"
                    + " WHERE (SELECT AVG(o.cost) FROM c.orders o) > 100";
       
View Full Code Here

    public void testCorrelatedSubquerySpecialCase1() {
        DomainObject o = qb.createQueryDefinition(Order.class);
        DomainObject a = qb.createSubqueryDefinition(o.get("customer").
            get("accounts"));
        o.select(o)
         .where(o.literal(10000).lessThan(a.select(a.get("balance")).all()));
       
        String jpql =
            "select o from Order o" + " where 10000 < ALL "
                + " (select a.balance from o.customer c "
                + "join o.customer.accounts a)";
View Full Code Here

    public void testCorrelatedSubquerySpecialCase2() {
        DomainObject o = qb.createQueryDefinition(Order.class);
        DomainObject c = o.join("customer");
        DomainObject a = qb.createSubqueryDefinition(c.get("accounts"));
        o.select(o)
         .where(o.literal(10000).lessThan(a.select(a.get("balance")).all()));
       
        String jpql = "select o from Order o JOIN o.customer c"
                    + " where 10000 < ALL "
                    + " (select a.balance from c.accounts a)";
       
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.