Package javax.persistence

Examples of javax.persistence.EntityTransaction.commit()


          .createQuery("select c from Usergroups as c where c.usergroup_id = :usergroup_id");
      query.setParameter("usergroup_id", usergroup_id.longValue());
      for (Iterator it2 = query.getResultList().iterator(); it2.hasNext();) {
        usergroups = (Usergroups) it2.next();
      }
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
    } catch (Exception ex2) {
      log.error("getGroup",ex2);
    }
    return usergroups;
View Full Code Here


        int k = 0;
        for (Iterator it2 = query.getResultList().iterator(); it2.hasNext();) {
          usergroups[k] = (Usergroups) it2.next();
          k++;
        }
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
        for (int vars = 0; vars < usergroups.length; vars++) {
          //groups[vars].setUsers(ResHandler.getUsermanagement().getUser(groups[vars].getUSER_ID()));
        }
      } catch (Exception ex2) {
View Full Code Here

            .createQuery("select c from Usergroups as c where c.usergroup_id = :usergroup_id");
        query.setParameter("usergroup_id", usergroup_id.longValue());
        for (Iterator it2 = query.getResultList().iterator(); it2.hasNext();) {
          groups = (Users_Usergroups) it2.next();
        }
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
        //TODO: Benutzer einer gruppe setzten
        //groups.setUsers(ResHandler.getUsermanagement().getUser(groups()));

      } catch (Exception ex2) {
View Full Code Here

        EntityTransaction tx = session.getTransaction();
        tx.begin();
        session.merge(usergroups);
        session.flush();
        session.refresh(usergroups);
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
      } catch (Exception ex2) {
        log.error("addGroup",ex2);
      }
    } else {
View Full Code Here

                "updatetime",
                new Long(-1))
            .setParameter("comment", comment).setParameter("usergroup_id",
                usergroup_id.longValue()).executeUpdate();
        res = "Success" + updatedEntities;
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
      } catch (Exception ex2) {
        log.error("updateGroup",ex2);
      }
    } else {
View Full Code Here

        String hqlUpdate = "delete Usergroups where usergroup_id= :usergroup_id";
        int updatedEntities = session.createQuery(hqlUpdate).setParameter(
            "usergroup_id", usergroup_id.longValue())
            .executeUpdate();
        res = "Success" + updatedEntities;
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
        deleteAllGroupUsers(usergroup_id);
      } catch (Exception ex2) {
        log.error("deleteGroup",ex2);
      }
View Full Code Here

        query.setParameter("usergroup_id", usergroup_id.longValue());
        query.setParameter("level_id", 1);
        for (Iterator it2 = query.getResultList().iterator(); it2.hasNext();) {
          groups = (Usergroups) it2.next();
        }
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
        //Todo: Set user
        //groups.setUsers(ResHandler.getUsermanagement().getUser(groups.getUSER_ID()));

      } catch (Exception ex2) {
View Full Code Here

          users = (Users) query.getSingleResult();
          } catch (NoResultException ex) {
          }
        session.refresh(users);
       
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
       
        //Somehow the Organizations are missing here o
       
       
View Full Code Here

            } else {
              if (!session.contains(user)) {
                session.merge(user);
            }
        }
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
      } catch (Exception ex2) {
        log.error("[updateUser] ",ex2);
      }
    } else {
View Full Code Here

      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery("select count(c.user_id) from Users c where c.deleted = 'false'");
      List ll = query.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
      log.info("selectMaxFromUsers"+(Long)ll.get(0));
      return (Long)ll.get(0);       
    } catch (Exception ex2) {
      log.error("[selectMaxFromUsers] ", ex2);
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.