Package org.hibernate.ogm

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


  @Test
  @SuppressWarnings("unchecked")
  public void testEntitiesInsertedInCurrentSessionAreFoundByNativeQuery() throws Exception {
    OgmSession session = openSession();
    Transaction transaction = session.beginTransaction();

    String nativeQuery = "{ name : 'Her Voice' }";

    Query query = session.createNativeQuery( nativeQuery )
        .addEntity( OscarWildePoem.class );
View Full Code Here


    result = query.list();
    assertThat( result ).onProperty( "id" ).containsExactly( 4L );

    transaction.commit();

    transaction = session.beginTransaction();
    session.delete( voice );
    transaction.commit();

    session.close();
  }
View Full Code Here

  }

  @Test
  public void testExceptionWhenReturnedEntityIsMissingAndManyResultsAreExpected() throws Exception {
    OgmSession session = openSession();
    Transaction transaction = session.beginTransaction();

    String nativeQuery = "{ $query : { author : 'Oscar Wilde' }, $orderby : { name : 1 } }";
    try {
      session.createNativeQuery( nativeQuery ).list();
    }
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.