Package org.hibernate.classic

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


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

    TimestampVersioned entity = new TimestampVersioned( "ts-vers" );
    s.save( entity );
    t.commit();
    s.close();

    Date initialVersion = entity.getVersion();
View Full Code Here


    Transaction t = s.beginTransaction();

    Human human = new Human();
    human.setName( new Name( "Stevee", 'X', "Ebersole" ) );

    s.save( human );
    s.flush();

    t.commit();

    String correctName = "Steve";
View Full Code Here

    Human mother = new Human();
    mother.setName( new Name( "Jane", 'E', null ) );
    human.setMother( mother );

    s.save( human );
    s.save( mother );
    s.flush();

    t.commit();
View Full Code Here

    Human mother = new Human();
    mother.setName( new Name( "Jane", 'E', null ) );
    human.setMother( mother );

    s.save( human );
    s.save( mother );
    s.flush();

    t.commit();

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

    s.beginTransaction();
    SimpleEntityWithAssociation owner = new SimpleEntityWithAssociation( "myEntity-1" );
    owner.addAssociation( "assoc-1" );
    owner.addAssociation( "assoc-2" );
    owner.addAssociation( "assoc-3" );
    s.save( owner );
    SimpleEntityWithAssociation owner2 = new SimpleEntityWithAssociation( "myEntity-2" );
    owner2.addAssociation( "assoc-1" );
    owner2.addAssociation( "assoc-2" );
    owner2.addAssociation( "assoc-3" );
    owner2.addAssociation( "assoc-4" );
View Full Code Here

    SimpleEntityWithAssociation owner2 = new SimpleEntityWithAssociation( "myEntity-2" );
    owner2.addAssociation( "assoc-1" );
    owner2.addAssociation( "assoc-2" );
    owner2.addAssociation( "assoc-3" );
    owner2.addAssociation( "assoc-4" );
    s.save( owner2 );
    SimpleEntityWithAssociation owner3 = new SimpleEntityWithAssociation( "myEntity-3" );
    s.save( owner3 );
    s.getTransaction().commit();
    s.close();
View Full Code Here

    owner2.addAssociation( "assoc-2" );
    owner2.addAssociation( "assoc-3" );
    owner2.addAssociation( "assoc-4" );
    s.save( owner2 );
    SimpleEntityWithAssociation owner3 = new SimpleEntityWithAssociation( "myEntity-3" );
    s.save( owner3 );
    s.getTransaction().commit();
    s.close();

    // now try the bulk delete
    s = openSession();
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.