Package com.mysql.clusterj

Examples of com.mysql.clusterj.Query


        setupQuery();
        // compare the column with the parameter
        dobj.where(equalA0.and(equalA1.and(equalA2.and(
                lessEqualA3.and(greaterA3)))));
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("a0", "dc=com");
        query.setParameter("a1", getA1for(NUMBER_OF_INSTANCES, 8));
        query.setParameter("a2", "ou=people");
        query.setParameter("a3Lower", getA3for(7));
        query.setParameter("a3Upper", getA3for(8));
        // get the results
        List<Dn2id> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Long> expected = new HashSet<Long>();
        expected.add((long)8);
View Full Code Here


        setupQuery();
        // compare the column with the parameter
        dobj.where(equalA0.and(equalA1.and(equalA2.and(
                lessA3.and(greaterA3)))));
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("a0", "dc=com");
        query.setParameter("a1", getA1for(NUMBER_OF_INSTANCES, 8));
        query.setParameter("a2", "ou=people");
        query.setParameter("a3Lower", getA3for(7));
        query.setParameter("a3Upper", getA3for(9));
        // get the results
        List<Dn2id> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Long> expected = new HashSet<Long>();
        expected.add((long)8);
View Full Code Here

        setupQuery();
        // compare the column with the parameter
        dobj.where(equalA0.and(equalA1.and(equalA2.and(
                betweenA3))));
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("a0", "dc=com");
        query.setParameter("a1", getA1for(NUMBER_OF_INSTANCES, 8));
        query.setParameter("a2", "ou=people");
        query.setParameter("a3Lower", getA3for(8));
        query.setParameter("a3Upper", getA3for(9));
        // get the results
        List<Dn2id> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Long> expected = new HashSet<Long>();
        expected.add((long)8);
View Full Code Here

        dobj.where(equalA0.and(equalA1.and(equalA2.and(equalA3)))
                .and(equalA4.and(equalA5.and(equalA6.and(equalA7))))
                .and(equalA8.and(equalA9.and(equalA10.and(equalA11))))
                .and(equalA12.and(equalA13.and(equalA14.and(equalA15)))));
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("a0", "dc=com");
        query.setParameter("a1", getA1for(NUMBER_OF_INSTANCES, 8));
        query.setParameter("a2", "ou=people");
        query.setParameter("a3", getA3for(8));
        query.setParameter("a4", "");
        query.setParameter("a5", "");
        query.setParameter("a6", "");
        query.setParameter("a7", "");
        query.setParameter("a8", "");
        query.setParameter("a9", "");
        query.setParameter("a10", "");
        query.setParameter("a11", "");
        query.setParameter("a12", "");
        query.setParameter("a13", "");
        query.setParameter("a14", "");
        query.setParameter("a15", "");
        // get the results
        List<Dn2id> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Long> expected = new HashSet<Long>();
        expected.add((long)8);
View Full Code Here

    protected void nontransactionalQuery(int... expected) {
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Employee.class);
        Query query = session.createQuery(dobj);
        List<Employee> result = query.getResultList();
        Set<Integer> expectedList = new HashSet<Integer>();
        for (int i: expected) {
            expectedList.add(i);
        }
        Set<Integer> actualList = new HashSet<Integer>();
View Full Code Here

        // compare the column with the parameter
        Predicate compare = column.equal(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter value
        query.setParameter("id", 8);
        // get the results
        List<Employee> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instance
        errorIfNotEqual("Wrong employee id returned from query: ",
                8, results.get(0).getId());
View Full Code Here

        // compare the column with the parameter
        Predicate compare = column.greaterThan(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("id", 6);
        // get the results
        List<Employee> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Integer> expected = new HashSet<Integer>();
        expected.add(7);
View Full Code Here

        // compare the column with the parameter
        Predicate compare = column.greaterEqual(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("id", 7);
        // get the results
        List<Employee> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Integer> expected = new HashSet<Integer>();
        expected.add(7);
View Full Code Here

        // compare the column with the parameter
        Predicate compare = column.lessThan(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("id", 3);
        // get the results
        List<Employee> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Integer> expected = new HashSet<Integer>();
        expected.add(0);
View Full Code Here

        // compare the column with the parameter
        Predicate compare = column.lessEqual(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);

        // set the parameter values
        query.setParameter("id", 2);
        // get the results
        List<Employee> results = query.getResultList();
        // consistency check the results
        consistencyCheck(results);
        // verify we got the right instances
        Set<Integer> expected = new HashSet<Integer>();
        expected.add(0);
View Full Code Here

TOP

Related Classes of com.mysql.clusterj.Query

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.