Package org.hibernate

Examples of org.hibernate.Transaction.wasRolledBack()


  public void beginTransaction(){
    if(transactions == null)
      return;
    // Would be written as a no-op in an EJB container with CMT
    Transaction tx = (Transaction)transactions.get();
    if (tx == null || tx.wasCommitted() || tx.wasRolledBack()) {
      Session ssn = (Session)sessions.get();
      if(ssn == null){
        ssn = getSession();
        tx = ssn.beginTransaction();
        transactions.set(tx);
View Full Code Here


  public void commit(){
    if(transactions == null)
      return;
    // Would be written as a no-op in an EJB container with CMT
    Transaction tx = (Transaction)transactions.get();
    if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
      tx.commit();
    }
    else{
      if(tx!=null && log.isWarnEnabled())
        log.warn("Trying to commit the uncommitable transaction, nothing to do.");
View Full Code Here

  public void rollback(){
    if(transactions == null)
      return;
    Transaction tx = (Transaction)transactions.get();
    transactions.set(null);
    if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
      tx.rollback();
    }
    else{
      if(tx!=null && log.isWarnEnabled())
        log.warn("Trying to rollback the unrollbackable transaction, nothing to do.");
View Full Code Here

   * Commit the database transaction.
   */
  public static void commitTransaction() throws InfrastructureException {
    Transaction tx = threadTransaction.get();
    try {
      if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
        log.debug("Committing database transaction of this thread.");
        tx.commit();
      }
      threadTransaction.set(null);
    } catch (HibernateException ex) {
View Full Code Here

   */
  public static void rollbackTransaction() throws InfrastructureException {
    Transaction tx = threadTransaction.get();
    try {
      threadTransaction.set(null);
      if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
        log.debug("Tyring to rollback database transaction of this thread.");
        tx.rollback();
      }
    } catch (HibernateException ex) {
      throw new InfrastructureException(ex);
View Full Code Here

   
    public static void commitTransaction() {
        Transaction trx = threadTransaction.get();
       
        try {
            if(trx != null && !trx.wasCommitted() && !trx.wasRolledBack()) {
                trx.commit();
                threadTransaction.set(null);
            }
        } catch(HibernateException e) {
            rollbackTransaction();
View Full Code Here

    public static void rollbackTransaction() {
        Transaction trx = threadTransaction.get();
        threadTransaction.set(null);
       
        try {
            if(trx != null && !trx.wasCommitted() && !trx.wasRolledBack()) {
                trx.rollback();
            }
        } finally {
            closeSession();
        }
View Full Code Here

  public static void commitTransaction() throws RepositoryException {
    // Boolean needed = (Boolean)commitNeeded.get();
    // if (needed.booleanValue()){
    Transaction tx = (Transaction) HibernateUtil.threadTransaction.get();
    try {
      if ( ( tx != null ) && !tx.wasCommitted() && !tx.wasRolledBack() ) {
        if ( HibernateUtil.debug ) {
          HibernateUtil.log.debug( Messages.getInstance().getString( "HIBUTIL.DEBUG_COMMIT_TRANS" ) ); //$NON-NLS-1$
        }
        tx.commit();
      }
View Full Code Here

   */
  public static void rollbackTransaction() throws RepositoryException {
    Transaction tx = (Transaction) HibernateUtil.threadTransaction.get();
    try {
      HibernateUtil.threadTransaction.set( null );
      if ( ( tx != null ) && !tx.wasCommitted() && !tx.wasRolledBack() ) {
        if ( HibernateUtil.debug ) {
          HibernateUtil.log.debug( Messages.getInstance().getString( "HIBUTIL.DEBUG_ROLLBACK" ) ); //$NON-NLS-1$
        }
        tx.rollback();
      }
View Full Code Here

  }
 
  public static void commitTransaction() {
    Transaction tx = threadTransaction.get();
    try {
      if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() )
        tx.commit();
      threadTransaction.set(null);
    } catch (HibernateException e) {
      logger.error("Exception " + e.getMessage(), e);
     
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.