Package org.hibernate

Examples of org.hibernate.Session.persist()


        sf.setDescription( description );
        session.save( sf );
        cloud.getBackupSnowFlakes().add( sf );
      }

      session.persist( cloud );

      transaction.commit();
      session.close();

      return cloud;
View Full Code Here


    b.setUserId( userId );
    final Integer stockCount = Integer.valueOf( RANDOM.nextInt() );
    b.setStockCount( stockCount );
    b.setType( BookmarkType.URL );

    session.persist( b );
    transaction.commit();

    session.clear();

    transaction = session.beginTransaction();
View Full Code Here

    Product product = new Product(
        "product-1",
        "Hybrid 25°",
        new Vendor( "Leaveland", 10 ), new Vendor( "Headaway", 9 )
    );
    session.persist( product );

    transaction.commit();
    session.clear();
    transaction = session.beginTransaction();
View Full Code Here

    // insert
    StockItem item = new StockItem();
    item.setId( "item-1" );
    item.setItemName( "Fairway Wood 19°" );
    item.setCount( 25 );
    session.persist( item );

    session.flush();

    // update
    item.setCount( 24 );
View Full Code Here

    // insert
    StockItem item = new StockItem();
    item.setId( "item-1" );
    item.setItemName( "Fairway Wood 19°" );
    item.setCount( 25 );
    session.persist( item );

    transaction.commit();
    session.clear();
    transaction = session.beginTransaction();
View Full Code Here

    int numInsert = 3;

    Session session = openSession();
    session.beginTransaction();
    for ( int i = 0; i < numInsert; i++ ) {
      session.persist( helicopter( "H" + i ) );
    }
    session.getTransaction().commit();
    session.close();

    Assertions.assertThat( LeakingMongoDBDialect.queueSize ).isEqualTo( numInsert );
View Full Code Here

    int numUpdate = 1;

    Session session = openSession();
    session.beginTransaction();
    Helicopter helicopter = helicopter( "H_tmp" );
    session.persist( helicopter );
    for ( int i = 0; i < numInsert; i++ ) {
      session.persist( helicopter( "H_" + i ) );
    }
    helicopter.setName( "H_" + numInsert );
    session.getTransaction().commit();
View Full Code Here

    Session session = openSession();
    session.beginTransaction();
    Helicopter helicopter = helicopter( "H_tmp" );
    session.persist( helicopter );
    for ( int i = 0; i < numInsert; i++ ) {
      session.persist( helicopter( "H_" + i ) );
    }
    helicopter.setName( "H_" + numInsert );
    session.getTransaction().commit();
    session.close();
View Full Code Here

    int numDelete = 3;

    Session session = openSession();
    session.beginTransaction();
    for ( int i = 0; i < numDelete; i++ ) {
      session.persist( helicopter( "H_" + i ) );
    }
    session.getTransaction().commit();
    session.close();

    LeakingMongoDBDialect.queueSize = -1;
View Full Code Here

    Session session = openSession();
    session.beginTransaction();
    List<Helicopter> helicopters = new ArrayList<Helicopter>();
    for ( int i = 0; i < numInsert; i++ ) {
      Helicopter helicopter = helicopter( "H_" + i );
      session.persist( helicopter );
      helicopters.add( helicopter );
    }
    for ( Helicopter helicopter : helicopters ) {
      session.delete( helicopter );
    }
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.