Package javax.persistence

Examples of javax.persistence.EntityManager.find()


        new FacesRequest("/page.xhtml") {
            @Override
            @SuppressWarnings("cast")
            protected void invokeApplication() throws Exception {
                EntityManager entityManager = (EntityManager) getValue("#{entityManager}");
                Thing thing = (Thing) entityManager.find(Thing.class, holder.get("id"));
                thing.setName("foo");
                entityManager.flush();
            }
        }.run();
View Full Code Here


      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
 
      privateMessageFolder = session.find(PrivateMessageFolder.class, privateMessageFolder.getPrivateMessageFolderId());
      session.remove(privateMessageFolder);
     
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
View Full Code Here

     
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      flv = session.find(Fieldlanguagesvalues.class, fieldlanguagesvalues_id);
      session.remove(flv);
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
      return new Long(-28);
View Full Code Here

      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      for (FlvRecordingLog flvRecordingLog : flvRecordingLogs) {
        flvRecordingLog = session.find(FlvRecordingLog.class, flvRecordingLog.getFlvRecordingLogId());
        session.remove(flvRecordingLog);
      }
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
View Full Code Here

      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      for (Iterator it = l.iterator(); it.hasNext();) {
        Sessiondata sData = (Sessiondata) it.next();
        sData = session.find(Sessiondata.class, sData.getId());
        session.remove(sData);
      }
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
View Full Code Here

        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
        tx.begin();
        sData = session.find(Sessiondata.class, sData.getId());
        session.remove(sData);
        PersistenceSessionUtil.closeSession(idf);
      }

    } catch (Exception err) {
View Full Code Here

      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
 
      ldapConfig = session.find(LdapConfig.class, ldapConfig.getLdapConfigId());
      session.remove(ldapConfig);
 
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
View Full Code Here

  {
    EntityManager em = getCurrent();
   
    if (em != null) {
      try {
        T value = em.find(entityClass, primaryKey);

        return value;
      } catch (RuntimeException e) {
        throw e;
      }
View Full Code Here

    }
   
    em = createEntityManager();
   
    try {
      T value = em.find(entityClass, primaryKey);

      return value;
    } finally {
      freeEntityManager(em);
    }
View Full Code Here

                    Map<String, Object> properties)
  {
    EntityManager em = getCurrent();
   
    if (em != null)
      return em.find(entityClass, primaryKey, properties);
   
    em = createEntityManager();
   
    try {
      return em.find(entityClass, primaryKey, properties);
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.