Package org.hibernate

Examples of org.hibernate.Session.persist()


    noDescription.setId( "19" );
    noDescription.setDescription( null );
    noDescription.setAuthor( withoutName );
    noDescription.setPosition( 7 );
    noDescription.setDate( calendar.getTime() );
    session.persist( noDescription );

    Helicopter helicopter = new Helicopter();
    helicopter.setMake( "Lama" );
    helicopter.setName( "No creative clue" );
    session.persist( helicopter );
View Full Code Here


    session.persist( noDescription );

    Helicopter helicopter = new Helicopter();
    helicopter.setMake( "Lama" );
    helicopter.setName( "No creative clue" );
    session.persist( helicopter );

    Helicopter anotherHelicopter = new Helicopter();
    anotherHelicopter.setMake( "Lama" );
    anotherHelicopter.setName( "Lama" );
    session.persist( anotherHelicopter );
View Full Code Here

    session.persist( helicopter );

    Helicopter anotherHelicopter = new Helicopter();
    anotherHelicopter.setMake( "Lama" );
    anotherHelicopter.setName( "Lama" );
    session.persist( anotherHelicopter );

    Helicopter yetAnotherHelicopter = new Helicopter();
    yetAnotherHelicopter.setMake( "Crusoe" );
    yetAnotherHelicopter.setName( "No creative clue" );
    session.persist( yetAnotherHelicopter );
View Full Code Here

        log.info("Registering " + member.getName());
        // em.persist(member);

        // using Hibernate session(Native API) and JPA entitymanager
        Session session = (Session) em.getDelegate();
        session.persist(member);
        memberEventSrc.fire(member);
    }
}
View Full Code Here

    public void register() throws Exception {
        log.info("Registering " + newMember.getName());

        // using Hibernate session(Native API) and JPA entitymanager
        Session session = (Session) em.getDelegate();
        session.persist(newMember);

        try {
            memberEventSrc.fire(newMember);
            initNewMember();
        } catch (Exception e) {
View Full Code Here

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

      session.persist( cloud );

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

      return cloud;
View Full Code Here

    session.save( sf2 );
    Cloud cloud = new Cloud();
    cloud.setLength( 23 );
    cloud.getProducedSnowFlakes().add( sf );
    cloud.getProducedSnowFlakes().add( sf2 );
    session.persist( cloud );
    session.flush();
    assertThat( getNumberOfEntities( sessions ) ).isEqualTo( 3 );
    assertThat( getNumberOfAssociations( sessions ) ).isEqualTo( 1 );
    transaction.commit();
View Full Code Here

    assertNotNull( cloud.getProducedSnowFlakes() );
    assertEquals( 2, cloud.getProducedSnowFlakes().size() );
    final SnowFlake removedSf = cloud.getProducedSnowFlakes().iterator().next();
    SnowFlake sf3 = new SnowFlake();
    sf3.setDescription( "Snowflake 3" );
    session.persist( sf3 );
    cloud.getProducedSnowFlakes().remove( removedSf );
    cloud.getProducedSnowFlakes().add( sf3 );
    transaction.commit();

    assertThat( getNumberOfEntities( sessions ) ).isEqualTo( 4 );
View Full Code Here

    Session session = openSession();

    session.beginTransaction();

    Planet planet = new Planet( "planet-1", "Pluto" );
    session.persist( planet );

    session.getTransaction().commit();
    session.close();

    return planet;
View Full Code Here

          annotatedCloud.getBackupSnowFlakes().add( sf );
        }
        cloud = annotatedCloud;
      }

      session.persist( cloud );

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

      @SuppressWarnings("unchecked")
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.