Package javax.persistence.criteria

Examples of javax.persistence.criteria.CriteriaBuilder.equal()


        // Use of JPA 2.0 criteria

        CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
        CriteriaQuery<Employee> criteriaQuery = criteriaBuilder.createQuery(Employee.class);
        Root<Employee> employee = criteriaQuery.from(Employee.class);
        criteriaQuery.select(employee).where(criteriaBuilder.equal(employee.get("name"), name));
        try {
            return this.entityManager.createQuery(criteriaQuery).getSingleResult();
        } catch (NoResultException nre) {
            return null;
        }
View Full Code Here


    EntityTransaction tx = em.getTransaction();
    tx.begin();
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Configuration> cq = cb.createQuery(Configuration.class);
    Root<Configuration> c = cq.from(Configuration.class);
    Predicate condition = cb.equal(c.get("deleted"), "false");
    cq.where(condition);
    TypedQuery<Configuration> q = em.createQuery(cq);
    List<Configuration> result = q.getResultList();
    try {
      tx.commit();
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Users> cq = cb.createQuery(Users.class);
      Root<Users> c = cq.from(Users.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      cq.where(condition);
      TypedQuery<Users> q = session.createQuery(cq);
      List<Users> ll = q.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Users> cq = cb.createQuery(Users.class);
      Root<Users> c = cq.from(Users.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      cq.where(condition);
      TypedQuery<Users> q = session.createQuery(cq);
      List<Users> ll = q.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
View Full Code Here

      tx.begin();
      session.flush();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Sessiondata> cq = cb.createQuery(Sessiondata.class);
      Root<Sessiondata> c = cq.from(Sessiondata.class);
      Predicate condition = cb.equal(c.get("session_id"), SID);
      cq.where(condition);

      TypedQuery<Sessiondata> q = session.createQuery(cq);

      List<Sessiondata> fullList = q.getResultList();
View Full Code Here

      tx.begin();
      session.flush();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Sessiondata> cq = cb.createQuery(Sessiondata.class);
      Root<Sessiondata> c = cq.from(Sessiondata.class);
      Predicate condition = cb.equal(c.get("session_id"), SID);
      cq.where(condition);

      TypedQuery<Sessiondata> q = session.createQuery(cq);
      List<Sessiondata> fullList = q.getResultList();
      tx.commit();
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Sessiondata> cq = cb.createQuery(Sessiondata.class);
      Root<Sessiondata> c = cq.from(Sessiondata.class);
      Predicate condition = cb.equal(c.get("session_id"), SID);
      cq.where(condition);

      TypedQuery<Sessiondata> q = session.createQuery(cq);

      List<Sessiondata> fullList = q.getResultList();
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Appointment> cq = cb.createQuery(Appointment.class);
      Root<Appointment> c = cq.from(Appointment.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      Predicate subCondition = cb.equal(c.get("categoryId"), cat_id);
      cq.where(condition, subCondition);
      TypedQuery<Appointment> q = session.createQuery(cq);
      List<Appointment> listAppoints = q.getResultList();
      tx.commit();
View Full Code Here

      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Appointment> cq = cb.createQuery(Appointment.class);
      Root<Appointment> c = cq.from(Appointment.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      Predicate subCondition = cb.equal(c.get("categoryId"), cat_id);
      cq.where(condition, subCondition);
      TypedQuery<Appointment> q = session.createQuery(cq);
      List<Appointment> listAppoints = q.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Configuration> cq = cb.createQuery(Configuration.class);
      Root<Configuration> c = cq.from(Configuration.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      cq.where(condition);
      cq.distinct(asc);
      if (asc){
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
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.