Package com.mysql.clusterj.query

Examples of com.mysql.clusterj.query.PredicateOperand


        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);
View Full Code Here


        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);
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

        // QueryBuilder is the sessionFactory for queries
        QueryBuilder builder = session.getQueryBuilder();
        // QueryDomainType is the main interface
        QueryDomainType<Employee>dobj = builder.createQueryDefinition(Employee.class);
        // parameter
        PredicateOperand param1 = dobj.param("param1");
        PredicateOperand param2 = dobj.param("param2");
        // property
        PredicateOperand propertyMagic = dobj.get("magic");
        PredicateOperand propertyId = dobj.get("id");
        // where
        // param1 is used in two different places but same type (int) in both
        dobj.where(propertyMagic.equal(param1).and(propertyId.between(param1, param2)));
        Query<Employee> query = session.createQuery(dobj);
        query.setParameter("param1", 4);
        query.setParameter("param2", 5);
        List<Employee> result = query.getResultList();
        errorIfNotEqual("Wrong size of result", 1, result.size());
View Full Code Here

            // QueryBuilder is the sessionFactory for queries
            QueryBuilder builder = session.getQueryBuilder();
            // QueryDomainType is the main interface
            QueryDomainType<Employee>dobj = builder.createQueryDefinition(Employee.class);
            // parameter
            PredicateOperand param1 = dobj.param("param1");
            PredicateOperand param2 = dobj.param("param2");
            // property
            PredicateOperand propertyAge = dobj.get("magic");
            PredicateOperand propertyMagic = dobj.get("name");
            // where
            // expect an exception here because param1 is used for String name and int magic
            dobj.where(propertyAge.equal(param1).and(propertyMagic.between(param1, param2)));
        } catch (ClusterJUserException e) {
            // good catch
        }
    }
View Full Code Here

        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);
View Full Code Here

        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.greaterThan(param);
        // set the where clause into the query
        dobj.where(compare);
        // create a query instance
        Query query = session.createQuery(dobj);
View Full Code Here

TOP

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

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.