Package org.hibernate.classic

Examples of org.hibernate.classic.Session.save()


    Zoo zoo = new Zoo();
    zoo.setName( "zoo" );

    Session s = openSession();
    Transaction t = s.beginTransaction();
    s.save( zoo );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here


    Session s = openSession();
    Transaction t = s.beginTransaction();

    IntegerVersioned entity = new IntegerVersioned( "int-vers" );
    s.save( entity );
    s.createQuery( "select id, name, version from IntegerVersioned" ).list();
    t.commit();
    s.close();

    Long initialId = entity.getId();
View Full Code Here

    Session s = openSession();
    Transaction t = s.beginTransaction();

    TimestampVersioned entity = new TimestampVersioned( "int-vers" );
    s.save( entity );
    s.createQuery( "select id, name, version from TimestampVersioned" ).list();
    t.commit();
    s.close();

    Long initialId = entity.getId();
View Full Code Here

    // multi-table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Session s = openSession();
    Transaction t = s.beginTransaction();
    Human joe = new Human();
    joe.setName( new Name( "Joe", 'Q', "Public" ) );
    s.save( joe );
    Human doll = new Human();
    doll.setName( new Name( "Kyu", 'P', "Doll" ) );
    doll.setFriends( new ArrayList() );
    doll.getFriends().add( joe );
    s.save( doll );
View Full Code Here

    s.save( joe );
    Human doll = new Human();
    doll.setName( new Name( "Kyu", 'P', "Doll" ) );
    doll.setFriends( new ArrayList() );
    doll.getFriends().add( joe );
    s.save( doll );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

    Transaction t = s.beginTransaction();

    Widget obj = new Widget();
    obj.setValueThree(5);

    Integer id = (Integer) s.save(obj);

    t.commit();
    s.close();

    s = openSession();
View Full Code Here

    obj.setValueOne(7);
    obj.setValueTwo(8);
    obj.setValueThree(9);
    obj.setValueFour(10);
    obj.setString("all-normal");
    s.save(obj);

    obj = new Widget();
    obj.setValueOne(1);
    obj.setValueTwo(2);
    obj.setValueThree(-1);
View Full Code Here

    obj.setValueOne(1);
    obj.setValueTwo(2);
    obj.setValueThree(-1);
    obj.setValueFour(-5);
    obj.setString("all-default");
    s.save(obj);

    t.commit();
    s.close();
  }
View Full Code Here

    SimpleEntityWithAssociation other = new SimpleEntityWithAssociation();
    entity.setName( "main" );
    other.setName( "many-to-many-association" );
    entity.getManyToManyAssociatedEntities().add( other );
    entity.addAssociation( "one-to-many-association" );
    s.save( entity );
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

  public void testIncrementCounterVersion() {
    Session s = openSession();
    Transaction t = s.beginTransaction();

    IntegerVersioned entity = new IntegerVersioned( "int-vers" );
    s.save( entity );
    t.commit();
    s.close();

    int initialVersion = entity.getVersion();
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.