Package javax.persistence.criteria

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


      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Rooms> cq = cb.createQuery(Rooms.class);
      Root<Rooms> c = cq.from(Rooms.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      Predicate subCondition = cb.equal(c.get("externalRoomType"), externalRoomType);
      cq.where(condition, subCondition);
      cq.distinct(asc);
      if (asc){
        cq.orderBy(cb.asc(c.get(orderby)));
View Full Code Here


      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Rooms> cq = cb.createQuery(Rooms.class);
      Root<Rooms> c = cq.from(Rooms.class);
      Predicate condition = cb.equal(c.get("deleted"), "false");
      Predicate subCondition = cb.equal(c.get("externalRoomType"), externalRoomType);
      cq.where(condition, subCondition);
      cq.distinct(asc);
      if (asc){
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
View Full Code Here

      tx.begin();
     
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Rooms_Organisation> cq = cb.createQuery(Rooms_Organisation.class);
      Root<Rooms_Organisation> c = cq.from(Rooms_Organisation.class);
      Predicate condition = cb.equal(c.get("rooms_organisation_id"), rooms_organisation_id);
      cq.where(condition);
      TypedQuery<Rooms_Organisation> q = session.createQuery(cq);
      List<Rooms_Organisation> ll = q.getResultList();
     
      tx.commit();
View Full Code Here

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Organisation> cq = cb.createQuery(Organisation.class);
      Root<Organisation> c = cq.from(Organisation.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

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

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<LdapConfig> cq = cb.createQuery(LdapConfig.class);
      Root<LdapConfig> c = cq.from(LdapConfig.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

        CriteriaBuilder builder = em.getCriteriaBuilder();
        CriteriaQuery<?> criteria = builder.createQuery(identityClass);
        Root<?> root = criteria.from(identityClass);

        List<Predicate> predicates = new ArrayList<Predicate>();
        predicates.add(builder.equal(root.get(identityNameProp.getName()), obj.getName()));
        predicates.add(builder.equal(root.get(identityTypeProp.getName()), lookupIdentityType(obj.getIdentityType().getName(), em)));

        // TODO add criteria for identity type

        criteria.where(predicates.toArray(new Predicate[predicates.size()]));
View Full Code Here

        CriteriaQuery<?> criteria = builder.createQuery(identityClass);
        Root<?> root = criteria.from(identityClass);

        List<Predicate> predicates = new ArrayList<Predicate>();
        predicates.add(builder.equal(root.get(identityNameProp.getName()), obj.getName()));
        predicates.add(builder.equal(root.get(identityTypeProp.getName()), lookupIdentityType(obj.getIdentityType().getName(), em)));

        // TODO add criteria for identity type

        criteria.where(predicates.toArray(new Predicate[predicates.size()]));
View Full Code Here

        CriteriaBuilder builder = em.getCriteriaBuilder();
        CriteriaQuery<?> criteria = builder.createQuery(credentialTypeNameProp.getDeclaringClass());
        Root<?> root = criteria.from(credentialTypeNameProp.getDeclaringClass());

        List<Predicate> predicates = new ArrayList<Predicate>();
        predicates.add(builder.equal(root.get(credentialTypeNameProp.getName()), name));
        criteria.where(predicates.toArray(new Predicate[predicates.size()]));

        return em.createQuery(criteria).getSingleResult();
    }
View Full Code Here

            CriteriaBuilder builder = em.getCriteriaBuilder();
            CriteriaQuery<?> criteria = builder.createQuery(relationshipTypeNameProp.getDeclaringClass());
            Root<?> root = criteria.from(relationshipTypeNameProp.getDeclaringClass());

            List<Predicate> predicates = new ArrayList<Predicate>();
            predicates.add(builder.equal(root.get(relationshipTypeNameProp.getName()), relationshipType.getName()));
            criteria.where(predicates.toArray(new Predicate[predicates.size()]));

            return em.createQuery(criteria).getSingleResult();
        } else {
            return relationshipType.getName();
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.