Package org.hibernate.ogm

Examples of org.hibernate.ogm.OgmSession.persist()


    EntityWithObjectIdAndEmbeddable entity = new EntityWithObjectIdAndEmbeddable();
    AnEmbeddable anEmbeddable = new AnEmbeddable( "a very nice string", null );
    entity.setAnEmbeddable( anEmbeddable );

    // when
    session.persist( entity );

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


    AnotherEmbeddable anotherEmbeddable = new AnotherEmbeddable( "Another nice string ... nested" );
    AnEmbeddable anEmbeddable = new AnEmbeddable( "a very nice string", anotherEmbeddable );
    entity.setAnEmbeddable( anEmbeddable );

    // when
    session.persist( entity );

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

    // given
    PianoPlayer ken = new PianoPlayer( "Ken Gold" );
    GuitarPlayer buck = new GuitarPlayer( "Buck Cherry" );
    // when
    session.persist( ken );
    session.persist( buck );

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

    // given
    PianoPlayer ken = new PianoPlayer( "Ken Gold" );
    GuitarPlayer buck = new GuitarPlayer( "Buck Cherry" );
    // when
    session.persist( ken );
    session.persist( buck );

    tx.commit();
    session.clear();
    tx = session.beginTransaction();
    ken = (PianoPlayer) session.load( PianoPlayer.class, ken.getId() );
View Full Code Here

    Transaction transaction = session.beginTransaction();

    // Given, When
    Husband husband = new Husband( "alex" );
    husband.setName( "Alex" );
    session.persist( husband );

    Wife wife = new Wife( "bea" );
    wife.setName( "Bea" );
    husband.setWife( wife );
    wife.setHusband( husband );
View Full Code Here

    Wife wife = new Wife( "bea" );
    wife.setName( "Bea" );
    husband.setWife( wife );
    wife.setHusband( husband );
    session.persist( wife );

    transaction.commit();
    session.clear();

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

    // given
    BarKeeper brian = new BarKeeper( new ObjectId(), "Brian" );

    // when
    session.persist( brian );

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

    BarKeeper brian = new BarKeeper( new ObjectId(), "Brian" );
    Drink cubaLibre = new Drink( new ObjectId(), "Cuba Libre" );
    brian.setFavoriteDrink( cubaLibre );

    // when
    session.persist( brian );
    session.persist( cubaLibre );

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

    Drink cubaLibre = new Drink( new ObjectId(), "Cuba Libre" );
    brian.setFavoriteDrink( cubaLibre );

    // when
    session.persist( brian );
    session.persist( cubaLibre );

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

    // given
    Bar goldFishBar = new Bar( "Goldfisch Bar" );

    // when
    session.persist( goldFishBar );

    tx.commit();
    assertThat( goldFishBar.getId() ).isNotNull();
    session.clear();
    tx = session.beginTransaction();
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.