Package org.hibernate

Examples of org.hibernate.Transaction.rollback()


      tx.commit();
      return true;
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      tx.rollback();
      return false;
    }
  }
 
  //保存对象 ,返回一个boolean 来判断状态
View Full Code Here


      transaction.commit();
      return true;
    } catch (HibernateException e) {
      // TODO Auto-generated catch block
      if(transaction!=null)
        transaction.rollback();
      e.printStackTrace();
    return false;
     
    }
 
View Full Code Here

      transaction.commit();
      return true;
    } catch (HibernateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      transaction.rollback();
      return false;
     
    }
  }
}
View Full Code Here

            assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
            assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
            assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

            // cleanup
            tx.rollback();
            s.close();
            return null;
         }
      });
   }
View Full Code Here

            assertEquals("NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount());
            assertEquals("NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount());
            assertEquals("NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount());

            // cleanup
            tx.rollback();
            s.close();
            return citizen;
         }
      });
View Full Code Here

            assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
            assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
            assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

            // cleanup
            tx.rollback();
            s.close();
            return null;
         }
      });
View Full Code Here

            assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
            assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
            assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

            // cleanup
            tx.rollback();
            s.close();
            return null;
         }
      });
View Full Code Here

      System.out.println();

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here

      System.out.println();

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here

      item.getBids().add(bid);

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
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.