Package com.mysql.clusterj.query

Examples of com.mysql.clusterj.query.QueryDomainType


        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand lower = dobj.param("lower");
        // parameter name
        PredicateOperand upper = dobj.param("upper");
        // property name
        PredicateOperand column = dobj.get("eid");
        // compare the column with the parameter
        Predicate compare = column.between(lower, upper);
        // 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("lower", (long)5);
View Full Code Here


        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand param = dobj.param("eid");
        // property name
        PredicateOperand column = dobj.get("eid");
        // 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("eid", (long)8);
View Full Code Here

        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand param = dobj.param("eid");
        // property name
        PredicateOperand column = dobj.get("eid");
        // 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("eid", (long)6);
View Full Code Here

        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand param = dobj.param("eid");
        // property name
        PredicateOperand column = dobj.get("eid");
        // 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("eid", (long)7);
View Full Code Here

        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand param = dobj.param("eid");
        // property name
        PredicateOperand column = dobj.get("eid");
        // 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("eid", (long)3);
View Full Code Here

        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Dn2id.class);

        // parameter name
        PredicateOperand param = dobj.param("eid");
        // property name
        PredicateOperand column = dobj.get("eid");
        // 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("eid", (long)2);
View Full Code Here

    protected void query() {
        tx = session.currentTransaction();
        tx.begin();
        QueryBuilder builder = session.getQueryBuilder();
        QueryDomainType dobj = builder.createQueryDefinition(NotPersistentTypes.class);
        dobj.where(dobj.get("id").equal(dobj.param("id")));
        Query query = session.createQuery(dobj);
        query.setParameter("id", 0);
        List<NotPersistentTypes> result = query.getResultList();
        int resultSize = result.size();
        errorIfNotEqual("Wrong query result size", 1, resultSize);
View Full Code Here

    }

    protected void badQuery() {
        try {
            QueryBuilder builder = session.getQueryBuilder();
            QueryDomainType dobj = builder.createQueryDefinition(NotPersistentTypes.class);
            dobj.where(dobj.get("notPersistentChildren").equal(dobj.param("id")));
            error("Failed to catch user exception for not-persistent query field");
        } catch (ClusterJUserException ex) {
            // good catch
        }
    }
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);
View Full Code Here

        tx.begin();
        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType dobj = builder.createQueryDefinition(Employee.class);

        // parameter name
        PredicateOperand param = dobj.param("id");
        // property name
        PredicateOperand column = dobj.get("id");
        // 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);
View Full Code Here

TOP

Related Classes of com.mysql.clusterj.query.QueryDomainType

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.