Examples of EntityTransaction


Examples of javax.persistence.EntityTransaction

   */
  public States getStateById(long state_id) {
    try {
      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session
          .createQuery("select c from States as c where c.state_id = :state_id AND c.deleted <> :deleted");
      query.setParameter("state_id", state_id);
      query.setParameter("deleted", "true");
      List ll = query.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
      if (ll.size() > 0) {
        return (States) ll.get(0);
      }
    } catch (Exception 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.