Package org.hibernate

Examples of org.hibernate.Transaction.rollback()


            }
            session.update(sqlWorkspace);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw new RuntimeException(e);
        }
    }
View Full Code Here


            session.save(longRunningProcess);
            session.update(user);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw new LumifyException("Could not add long running process: " + longRunningProcessQueueItem.toString(), e);
        }
        return longRunningProcessId;
    }
View Full Code Here

            transaction = session.beginTransaction();
            session.delete(sqlLongRunningProcess);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            updateLongRunningProcessAction.run(longRunningProcess);
            session.update(longRunningProcess);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw new LumifyException("Could not update long running process: " + longRunningProcess.toString(), e);
        }
    }
View Full Code Here

    try {
      session.createNativeQuery( nativeQuery ).uniqueResult();
      transaction.commit();
    }
    catch (Exception he) {
      transaction.rollback();
      String message = he.getMessage();
      assertThat( message )
        .as( "The native query doesn't define a returned entity, there should be a specific exception" )
        .contains( "OGM001217" );
    }
View Full Code Here

    String nativeQuery = "{ $query : { author : 'Oscar Wilde' }, $orderby : { name : 1 } }";
    try {
      session.createNativeQuery( nativeQuery ).list();
    }
    catch (Exception he) {
      transaction.rollback();
      String message = he.getMessage();
      assertThat( message )
        .as( "The native query doesn't define a returned entity, there should be a specific exception" )
        .contains( "OGM001217" );
    }
View Full Code Here

      transaction.commit();

    } catch (Exception a_th) {
      if (transaction != null) {
        transaction.rollback();
      }
      throw new RuntimeException(a_th);
    }
  }
View Full Code Here

//      transaction.commit();

    } catch (Exception a_th) {
      if (transaction != null) {
        transaction.rollback();
      }
      throw new RuntimeException(a_th);
    } finally {
      close(sessionFactory, session);
    }
View Full Code Here

      transaction.commit();

    } catch (Exception a_th) {
      if (transaction != null) {
        transaction.rollback();
      }
      throw new RuntimeException(a_th);
    }
  }
View Full Code Here

      log.debug("rolling back JPA resource-local transaction");
      // TODO: translate exceptions that occur into the correct JTA exception
      Transaction delegate = getDelegate();
      rollbackOnly = false;
      boolean tempSynchronizationRegistered = synchronizationRegistered;
      delegate.rollback();
      if (!tempSynchronizationRegistered)
      {
         getSynchronizations().afterTransactionCompletion(false);
      }
   }
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.