Package org.hibernate.ogm

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


        .uniqueResult();

    assertThat( poem ).isEqualTo( portia );

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

  @Test
  public void testListMultipleResultQuery() throws Exception {
View Full Code Here


        .list();

    assertThat( result ).as( "Unexpected number of results" ).containsExactly( athanasia, ballade, portia );

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

  @Test
  public void testListMultipleResultQueryWithoutReturnedType() throws Exception {
View Full Code Here

    Object[] portiaRow = result.get( 2 );
    assertThat( portiaRow[0] ).isEqualTo( portia.getName() );
    assertThat( portiaRow[1] ).isEqualTo( portia.getAuthor() );

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

  @Test
  public void testUniqueResultNamedNativeQuery() throws Exception {
View Full Code Here

          .uniqueResult();
      assertThat( uniqueResult ).isEqualTo( athanasia );
      transaction.commit();
    }
    finally {
      session.clear();
      session.close();
    }
  }

  @Test
View Full Code Here

      OscarWildePoem uniqueResult = (OscarWildePoem) query.uniqueResult();
      assertThat( uniqueResult ).isEqualTo( portia );
      transaction.commit();
    }
    finally {
      session.clear();
      session.close();
    }
  }

  @Test
View Full Code Here

    List<OscarWildePoem> result = query.list();

    assertThat( result ).containsExactly( ballade, portia );

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

  }

  @Test
View Full Code Here

    List<OscarWildePoem> result = query.list();

    assertThat( result ).containsExactly( athanasia, ballade );

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

  @Test
  public void testListMultipleResultQueryWithFirstResultAndMaxRows() throws Exception {
View Full Code Here

    // when
    session.persist( entity );

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

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

    // then
View Full Code Here

    // when
    session.persist( entity );

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

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

    // then
View Full Code Here

    // when
    session.persist( ken );
    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
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.