Package javax.persistence

Examples of javax.persistence.EntityManager.createQuery()


          " AND u.deleted <> :deleted";
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("resethash", hash);
      query.setParameter("deleted", "true");
      Users us = null;
      try {
        us = (Users) query.getSingleResult();
View Full Code Here


      //get all users
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("search", StringUtils.lowerCase(search));
      List ll = query.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
      log.info("selectMaxFromUsers"+(Long)ll.get(0));
View Full Code Here

      tx.begin();
      CriteriaBuilder cb = session.getCriteriaBuilder();
      CriteriaQuery<Salutations> cq = cb.createQuery(Salutations.class);
      Root<Salutations> from = cq.from(Salutations.class);
      CriteriaQuery<Salutations> select = cq.select(from);
      TypedQuery<Salutations> q = session.createQuery(select);
      List<Salutations> ll = q.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
      for (Iterator it4 = ll.iterator(); it4.hasNext();) {
        Salutations ti = (Salutations) it4.next();
View Full Code Here

      String hql = "select c from Adresses as c where c.adresses_id = :adresses_id";
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("adresses_id", new Long(adresses_id));
      Adresses addr = null;
      try {
        addr = (Adresses) query.getSingleResult();
        } catch (NoResultException ex) {
View Full Code Here

        //"and c.deleted <> :deleted";
    Object idf = PersistenceSessionUtil.createSession();
    EntityManager session = PersistenceSessionUtil.getSession();
    EntityTransaction tx = session.getTransaction();
      tx.begin();
    Query query = session.createQuery(hql);
    query.setParameter("email", email);
    //query.setParameter("deleted", "true");
   
    List<Adresses> addr = query.getResultList();
   
View Full Code Here

    try {
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session
          .createQuery("select c from Users_Usergroups as c where c.user_id = :user_id");
      query.setParameter("user_id", USER_ID.longValue());
      int count = query.getResultList().size();
      usersusergroups = new Users_Usergroups[count];
      int k = 0;
View Full Code Here

     
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("userSipDataId", userSipDataId);
      UserSipData userSipData = null;
      try {
        userSipData = (UserSipData) query.getSingleResult();
        } catch (NoResultException ex) {
View Full Code Here

    try {
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session
          .createQuery("select c from Users_Usergroups as c where c.user_id = :user_id");
      query.setParameter("user_id", USER_ID);
      for (Iterator it2 = query.getResultList().iterator(); it2.hasNext();) {
        usersusergroups = (Users_Usergroups) it2.next();
      }
View Full Code Here

      tx.begin();
        String hqlUpdate = " UPDATE Users_Usergroups set "
            + " usergroup_id = :usergroup_id, user_id = :user_id, "
            + " updatetime = :updatetime, comment = :comment "
            + " where users_usergroups_id= :users_usergroups_id";
        int updatedEntities = session.createQuery(hqlUpdate).setParameter(
            "usergroup_id", usergroup_id.longValue()).setParameter(
            "user_id", user_id.longValue()).setParameter("updatetime",
            new Long(-1)).setParameter(
            "comment", comment).setParameter("users_usergroups_id",
            users_usergroups_id.longValue()).executeUpdate();
View Full Code Here

        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
      tx.begin();
        String hqlUpdate = "delete users_usergroups where users_usergroups_id= :users_usergroups_id";
        int updatedEntities = session.createQuery(hqlUpdate).setParameter(
            "UID", users_usergroups_id.longValue()).executeUpdate();
        res = "Success" + updatedEntities;
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
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.