Package org.hibernate

Examples of org.hibernate.Session.update()


  protected void update(T obj) throws Exception {
    try {
      Session session = getSession();
     
      session.update(obj);
    } catch (HibernateException e) {
      handleException(e);
    }
  }
View Full Code Here


  protected void updateObj(Object o) {
    Session session = Helper.getHibernateSession();
    if (session == null) {
      session = HibernateUtil.getSessionFactory().openSession();
      session.update(o);
      session.close();
    }
    session.update(o);
  }
View Full Code Here

    if (session == null) {
      session = HibernateUtil.getSessionFactory().openSession();
      session.update(o);
      session.close();
    }
    session.update(o);
  }

  @SuppressWarnings("rawtypes")
  protected List retrieveObjs(String queryString, String parameter) throws DAOException {
    try {
View Full Code Here

   }

   public Object update(Object obj) throws Exception
   {
      Session session = openSession();
      session.update(obj);
      session.flush();
      return obj;
   }

   public Object save(Object obj) throws Exception
View Full Code Here

    beginTx();
    try {
      s = openSession();
      txn = s.beginTransaction();
      s.update(item);
      txn.commit();
      fail("expected stale write to fail");
    }
    catch (Exception e) {
      setRollbackOnlyTxExpected(e);
View Full Code Here

        // Begin second unit of work

        Session session2 = HibernateUtil.getSessionFactory().getCurrentSession();
        session2.beginTransaction();

        session2.update(aPerson); // Reattachment of aPerson

        session2.getTransaction().commit();
    }

    private void addEmailToPerson(Long personId, String emailAddress) {
View Full Code Here

      tm.begin();
      try {
          Session session = sessionFactory.getCurrentSession();
          Object account = session.get(acctClass, id);
          setBranch.invoke(account, branch);
          session.update(account);
          tm.commit();
      }
      catch (Exception e) {
         log.error("rolling back", e);
         tm.rollback();
View Full Code Here

      tm.begin();
      try {
          Session session = sessionFactory.getCurrentSession();
          Object account = session.get(acctClass, id);
          setBalance.invoke(account, newBalance);
          session.update(account);
          tm.commit();
      }
      catch (Exception e) {
          log.error("rolling back", e);
          tm.rollback();
View Full Code Here

        item.setVersion(new Long(item.getVersion().longValue() - 1));

        try {
            s = openSession();
            txn = s.beginTransaction();
            s.update(item);
            txn.commit();
            s.close();
            fail("expected stale write to fail");
        } catch (Throwable expected) {
            // expected behavior here
View Full Code Here

    private void updateProcessLog(long processInstanceId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        ProcessInstanceLog log = (ProcessInstanceLog) session.load(ProcessInstanceLog.class, processInstanceId);
        log.setEnd(new Date());
        session.update(log);
        session.getTransaction().commit();
    }
   
    private void addNodeEnterLog(long processInstanceId, String processId, String nodeInstanceId, String nodeId) {
        NodeInstanceLog log = new NodeInstanceLog(NodeInstanceLog.TYPE_ENTER, processInstanceId, processId, nodeInstanceId, nodeId);
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.