Package org.hibernate

Examples of org.hibernate.StatelessSession.beginTransaction()


    ss.close();
  }

  public void testRefresh() {
    StatelessSession ss = getSessions().openStatelessSession();
    Transaction tx = ss.beginTransaction();
    Paper paper = new Paper();
    paper.setColor( "whtie" );
    ss.insert( paper );
    tx.commit();
    ss.close();
View Full Code Here


    ss.insert( paper );
    tx.commit();
    ss.close();

    ss = getSessions().openStatelessSession();
    tx = ss.beginTransaction();
    Paper p2 = ( Paper ) ss.get( Paper.class, paper.getId() );
    p2.setColor( "White" );
    ss.update( p2 );
    tx.commit();
    ss.close();
View Full Code Here

    ss.update( p2 );
    tx.commit();
    ss.close();

    ss = getSessions().openStatelessSession();
    tx = ss.beginTransaction();
    assertEquals( "whtie", paper.getColor() );
    ss.refresh( paper );
    assertEquals( "White", paper.getColor() );
    ss.delete( paper );
    tx.commit();
View Full Code Here

    s.save( task );
    s.getTransaction().commit();
    s.close();

    StatelessSession ss = sfi().openStatelessSession();
    ss.beginTransaction();
    Task taskRef = ( Task ) ss.createQuery( "from Task t join fetch t.resource join fetch t.user" ).uniqueResult();
    assertTrue( taskRef != null );
    assertTrue( Hibernate.isInitialized( taskRef ) );
    assertTrue( Hibernate.isInitialized( taskRef.getUser() ) );
    assertTrue( Hibernate.isInitialized( taskRef.getResource() ) );
View Full Code Here

  }

  private void inTransactionWrapper() {
    StatelessSession session = sessionFactory.openStatelessSession();
    try {
      Transaction transaction = session.beginTransaction();
      loadAllIdentifiers( session );
      transaction.commit();
    } catch (InterruptedException e) {
      // just quit
    }
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.