Package org.hibernate.ogm

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


    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    EntityWithObjectIdAndEmbeddable loaded = (EntityWithObjectIdAndEmbeddable) session.load( EntityWithObjectIdAndEmbeddable.class, entity.getId() );

    // then
    assertThat( loaded.getId() ).isEqualTo( entity.getId() );
    assertThat( loaded.getAnEmbeddable().getEmbeddedString() ).isEqualTo( entity.getAnEmbeddable().getEmbeddedString() );
    assertThat( loaded.getAnEmbeddable().getAnotherEmbeddable() ).isEqualTo( entity.getAnEmbeddable().getAnotherEmbeddable() );
View Full Code Here


    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    EntityWithObjectIdAndEmbeddable loaded = (EntityWithObjectIdAndEmbeddable) session.load( EntityWithObjectIdAndEmbeddable.class, entity.getId() );

    // then
    assertThat( loaded.getId() ).isEqualTo( entity.getId() );
    assertThat( loaded.getAnEmbeddable().getEmbeddedString() ).isEqualTo( entity.getAnEmbeddable().getEmbeddedString() );
    assertThat( loaded.getAnEmbeddable().getAnotherEmbeddable().getEmbeddedString() ).isEqualTo(
View Full Code Here

    session.persist( buck );

    tx.commit();
    session.clear();
    tx = session.beginTransaction();
    ken = (PianoPlayer) session.load( PianoPlayer.class, ken.getId() );
    buck = (GuitarPlayer) session.load( GuitarPlayer.class, buck.getId() );

    // then
    assertThat( ken.getId() ).isEqualTo( 1L );
    assertThat( buck.getId() ).isEqualTo( 1L );
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();
    ken = (PianoPlayer) session.load( PianoPlayer.class, ken.getId() );
    buck = (GuitarPlayer) session.load( GuitarPlayer.class, buck.getId() );

    // then
    assertThat( ken.getId() ).isEqualTo( 1L );
    assertThat( buck.getId() ).isEqualTo( 1L );
    assertCountQueryResult( session, "db.PianoPlayerSequence.count( { '_id' : 'pianoPlayer', 'nextPianoPlayerId' : 2 } )", 1 );
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    BarKeeper brianLoaded = (BarKeeper) session.load( BarKeeper.class, brian.getId() );

    // then
    assertThat( brianLoaded.getId() ).isEqualTo( brian.getId() );
    assertThat( brianLoaded.getName() ).isEqualTo( "Brian" );
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    BarKeeper brianLoaded = (BarKeeper) session.load( BarKeeper.class, brian.getId() );

    // then
    assertThat( brianLoaded.getName() ).isEqualTo( "Brian" );
    assertThat( brianLoaded.getFavoriteDrink() ).isNotNull();
    assertThat( brianLoaded.getFavoriteDrink().getName() ).isEqualTo( "Cuba Libre" );
View Full Code Here

    tx.commit();
    assertThat( goldFishBar.getId() ).isNotNull();
    session.clear();
    tx = session.beginTransaction();

    Bar barLoaded = (Bar) session.load( Bar.class, goldFishBar.getId() );

    // then
    assertThat( barLoaded.getName() ).isEqualTo( "Goldfisch Bar" );

    tx.commit();
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    // then
    Bar barLoaded = (Bar) session.load( Bar.class, goldFishBar.getId() );

    assertThat( barLoaded.getName() ).isEqualTo( "Goldfisch Bar" );
    assertThat( barLoaded.getMusicGenre() ).isNotNull();
    assertThat( barLoaded.getMusicGenre().getName() ).isEqualTo( "Classic Rock" );
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    MusicGenre genreLoaded = (MusicGenre) session.load( MusicGenre.class, goldFishBar.getMusicGenre().getId() );
    assertThat( genreLoaded.getPlayedIn() ).onProperty( "name" ).containsOnly( "Goldfisch Bar", "Shark Station" );

    tx.commit();
    session.close();
  }
View Full Code Here

    tx.commit();
    session.clear();
    tx = session.beginTransaction();

    // then
    Bar barLoaded = (Bar) session.load( Bar.class, goldFishBar.getId() );
    assertThat( barLoaded.getDoorMen() ).onProperty( "name" ).containsOnly( "Bruce", "Dwain" );

    tx.commit();
    session.close();
  }
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.