Package org.hibernate

Examples of org.hibernate.Transaction.begin()


      return methodInvocation.proceed();
    }

    //开始一个新的事务
    if(type != TransactionalType.READOLNY){
      transaction.begin();
    }
   
    Object result = null;
    try {
      //执行被拦截的业务方法
View Full Code Here


  @BeforeClass
  public static void addTestEntities() {
    Session session = sessions.openSession();
    Transaction transaction = session.getTransaction();
    transaction.begin();

    Hypothesis hypothesis = new Hypothesis();
    hypothesis.setId( "1" );
    hypothesis.setPosition( 1 );
    hypothesis.setDescription( "Alea iacta est." );
View Full Code Here

  @AfterClass
  public static void deleteTestEntities() throws Exception {
    Session session = sessions.openSession();
    Transaction transaction = session.getTransaction();
    transaction.begin();

    session.delete( new Hypothesis( "1" ) );
    session.delete( new Hypothesis( "2" ) );
    session.delete( new Hypothesis( "3" ) );
    session.delete( new Hypothesis( "4" ) );
View Full Code Here

  @Test
  public void testLoadSelectedAssociationColumns() {
    Session session = openSession();
    final Transaction transaction = session.getTransaction();
    transaction.begin();

    Module mongodb = new Module();
    mongodb.setName( "MongoDB" );
    session.persist( mongodb );
View Full Code Here

  }

  private Transaction beginTransaction(Session session) throws ClassNotFoundException, NoSuchMethodException,
      IllegalAccessException, InvocationTargetException {
    Transaction transaction = Helper.getTransactionAndMarkForJoin( session );
    transaction.begin();
    return transaction;
  }

  private Session openSession(Session upperSession) {
    Session session = upperSession;
View Full Code Here

  }

  private Transaction beginTransaction(Session session) throws ClassNotFoundException, NoSuchMethodException,
      IllegalAccessException, InvocationTargetException {
    Transaction transaction = Helper.getTransactionAndMarkForJoin( session );
    transaction.begin();
    return transaction;
  }

  private Session openSession(Session upperSession) {
    Session session = upperSession;
View Full Code Here

  }

  public Transaction beginTransaction() throws HibernateException {
    errorIfClosed();
    Transaction result = getTransaction();
    result.begin();
    return result;
  }

  public boolean isEventSource() {
    return false;
View Full Code Here

    session.setFlushMode( FlushMode.MANUAL );
    session.setCacheMode( cacheMode );
    session.setDefaultReadOnly( true );
    try {
      Transaction transaction = Helper.getTransactionAndMarkForJoin( session );
      transaction.begin();
      loadAllFromQueue( session );
      transaction.commit();
    }
    finally {
      producerEndSignal.countDown();
View Full Code Here

    if ( upperSession == null ) {
      session = sessionFactory.openStatelessSession();
    }
    try {
      Transaction transaction = Helper.getTransactionAndMarkForJoin( session );
      transaction.begin();
      loadAllIdentifiers( session );
      transaction.commit();
    }
    catch (InterruptedException e) {
      // just quit
View Full Code Here

      // todo : should seriously consider not allowing a txn to begin from a child session
      //      can always route the request to the root session...
      log.warn( "Transaction started on non-root session" );
    }
    Transaction result = getTransaction();
    result.begin();
    return result;
  }
 
  public void afterTransactionBegin(Transaction tx) {
    errorIfClosed();
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.