Package javax.persistence.criteria

Examples of javax.persistence.criteria.CriteriaQuery.where()


        String jpql = "SELECT SIZE(d.employees) FROM Department d "
         + "WHERE d.name = 'Sales'";
       
        CriteriaQuery q = cb.createQuery();
        Root<Department> d = q.from(Department.class);
        q.where(cb.equal(
                d.get(department_.getSingularAttribute("name", String.class)),
                "Sales"));
        SetAttribute<Department, Employee> employees =
            department_.getDeclaredSet("employees", Employee.class);
        q.select(cb.size(d.get(employees)));
View Full Code Here


            query.multiselect(from.get("committer"), from.get("timestamp"), from.get("context"), from.get("comment"),
                from.get("revision"), from.get("parent"), from.get("domainId"), from.get("connectorId"),
                from.get("instanceId"));

            Predicate[] predicates = convertCommitRequestToPredicates(criteriaBuilder, from, request);
            query.where(criteriaBuilder.and(predicates));
            query.orderBy(criteriaBuilder.asc(from.get("timestamp")));
            TypedQuery<Object[]> typedQuery = entityManager.createQuery(query);
            List<CommitMetaInfo> infos = new ArrayList<>();
            for (Object[] row : typedQuery.getResultList()) {
                CommitMetaInfo info = new CommitMetaInfo();
View Full Code Here

        Root<Customer> customer = cquery.from(Customer.class);

        //Get Metamodel from Root
        EntityType<Customer> Customer_ = customer.getModel();

        cquery.where(cb.equal(
                customer.get(Customer_.getSingularAttribute("name", String.class)),
                cb.nullLiteral(String.class)));

        Query q = em.createQuery(cquery);
    }
View Full Code Here

        {
          predicate = cb.equal(propertyExpression, value);
        }
        else if (PersistenceCriterion.OPERATOR_EQ_OR_NULL.equals(operator))
        {
          cq.where(predicate = cb.disjunction());
          cq.where(cb.isNull(propertyExpression));
          cq.where(cb.equal(propertyExpression, value));
          continue;
        }
        else if (PersistenceCriterion.OPERATOR_NEQ.equals(operator))
View Full Code Here

          predicate = cb.equal(propertyExpression, value);
        }
        else if (PersistenceCriterion.OPERATOR_EQ_OR_NULL.equals(operator))
        {
          cq.where(predicate = cb.disjunction());
          cq.where(cb.isNull(propertyExpression));
          cq.where(cb.equal(propertyExpression, value));
          continue;
        }
        else if (PersistenceCriterion.OPERATOR_NEQ.equals(operator))
        {
View Full Code Here

        }
        else if (PersistenceCriterion.OPERATOR_EQ_OR_NULL.equals(operator))
        {
          cq.where(predicate = cb.disjunction());
          cq.where(cb.isNull(propertyExpression));
          cq.where(cb.equal(propertyExpression, value));
          continue;
        }
        else if (PersistenceCriterion.OPERATOR_NEQ.equals(operator))
        {
          predicate = cb.notEqual(propertyExpression, value);
View Full Code Here

        else if (PersistenceCriterion.OPERATOR_NULL.equals(operator))
        {
          predicate = cb.isNull(propertyExpression);
        }

        cq.where(predicate);
      }

      // Run query and wrap result list into a collection that calls onLoad for each element that is being accessed.
      Query typeQuery = getEntityManager().createQuery(cq);
      if (query.getMaxResults() > 0)
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.