Package javax.jdo

Examples of javax.jdo.Query.addSubquery()


    /** */
    void runTestNullVariable(PersistenceManager pm) {
        Query apiQuery = pm.newQuery(Employee.class);
        try {
            apiQuery.addSubquery(null, null, null);
            apiQuery.compile();
            fail(ASSERTION_FAILED,
                 "addSubquery called with a null varible declaration must throw a JDOUserException.");
        } catch (JDOException ex) {
            // expected JDOException
View Full Code Here


    /** */
    void runTestEmptyVariable(PersistenceManager pm) {
        Query apiQuery = pm.newQuery(Employee.class);
        try {
            apiQuery.addSubquery(null, " ", null);
            apiQuery.compile();
            fail(ASSERTION_FAILED,
                 "addSubquery called with an empty varible declaration must throw a JDOUserException.");
        } catch (JDOException ex) {
            // expected JDOException
View Full Code Here

                        false, null, averageWeeklyHours, true);

        // execute API query
        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours> averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

        // execute subquery again
        executeJDOQuery(ASSERTION_FAILED, sub, singleStringJDOQLSubquery,
View Full Code Here

        Query sub = newPM.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");

        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours> averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);
    }

    /**
 
View Full Code Here

        // API query
        Query sub = pm.newQuery(Department.class);
        sub.setResult("MAX(this.employees.size())");
        Query apiQuery = pm.newQuery(Department.class);
        apiQuery.setFilter("this.employees.size() == number");
        apiQuery.addSubquery(sub, "long number", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

        // API query against memory model
        List allDepartments = getAllPersistentInstances(pm, Department.class);
View Full Code Here

        // API query
        Query sub = pm.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");
        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours> averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

        // API query against memory model
        List allEmployees = getAllEmployees(pm);
View Full Code Here

        // API query
        Query sub = pm.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");
        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.hiredate > :hired && this.weeklyhours > averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, new Object[]{hired}, expectedResult, true);

        // API query against memory model
        List allEmployees = getAllEmployees(pm);
View Full Code Here

        Query sub = pm.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");
        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours > averageWeeklyhours");
        // null candidate collection
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

        apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours > averageWeeklyhours");
View Full Code Here

                        false, null, expectedResult, true);

        apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours > averageWeeklyhours");
        // empty candidate collection
        apiQuery.addSubquery(sub, "double averageWeeklyhours", " ");
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

    }
View Full Code Here

        Query sub = pm.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");
        sub.setFilter("this.manager == :manager");
        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours> averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours",
                             "this.department.employees", "this.manager");
        executeJDOQuery(ASSERTION_FAILED, apiQuery, singleStringJDOQL,
                        false, null, expectedResult, true);

        // API query against memory model
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.