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

    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

      butterfly.setDescription( "Butterfly" );

      catepillar.setMother( butterfly );
      butterfly.addOffspring( catepillar );

      s.save( frog );
      s.save( polliwog );
      s.save( butterfly );
      s.save( catepillar );

      Dog dog = new Dog();
View Full Code Here

      catepillar.setMother( butterfly );
      butterfly.addOffspring( catepillar );

      s.save( frog );
      s.save( polliwog );
      s.save( butterfly );
      s.save( catepillar );

      Dog dog = new Dog();
      dog.setBodyWeight( 200 );
View Full Code Here

      catepillar.setMother( butterfly );
      butterfly.addOffspring( catepillar );

      s.save( frog );
      s.save( polliwog );
      s.save( butterfly );
      s.save( catepillar );

      Dog dog = new Dog();
      dog.setBodyWeight( 200 );
      dog.setDescription( "dog" );
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.