Package org.hibernate.ogm.backendtck.simpleentity

Examples of org.hibernate.ogm.backendtck.simpleentity.Hero


    TransactionManager transactionManager = extractJBossTransactionManager( emf );

    transactionManager.begin();
    final EntityManager em = emf.createEntityManager();
    Hero h = new Hero();
    h.setName( "Spartacus" );
    em.persist( h );
    SuperHero sh = new SuperHero();
    sh.setName( "Batman" );
    sh.setSpecialPower( "Technology and samurai techniques" );
    em.persist( sh );
    transactionManager.commit();

    em.clear();

    transactionManager.begin();
    Hero lh = em.find( Hero.class, h.getName() );
    assertThat( lh ).isNotNull();
    assertThat( lh ).isInstanceOf( Hero.class );
    Hero lsh = em.find( Hero.class, sh.getName() );
    assertThat( lsh ).isNotNull();
    assertThat( lsh ).isInstanceOf( SuperHero.class );
    em.remove( lh );
    em.remove( lsh );
View Full Code Here


    TransactionManager transactionManager = extractJBossTransactionManager( emf );

    transactionManager.begin();
    final EntityManager em = emf.createEntityManager();
    Hero h = new Hero();
    h.setName( "Spartacus" );
    em.persist( h );
    SuperHero sh = new SuperHero();
    sh.setName( "Batman" );
    sh.setSpecialPower( "Technology and samurai techniques" );
    em.persist( sh );
    HeroClub hc = new HeroClub();
    hc.setName( "My hero club" );
    hc.getMembers().add( h );
    hc.getMembers().add( sh );
    em.persist( hc );
    transactionManager.commit();

    em.clear();

    transactionManager.begin();
    HeroClub lhc = em.find( HeroClub.class, hc.getName() );
    assertThat( lhc ).isNotNull();
    Hero lh = lhc.getMembers().get( 0 );
    assertThat( lh ).isNotNull();
    assertThat( lh ).isInstanceOf( Hero.class );
    Hero lsh = lhc.getMembers().get( 1 );
    assertThat( lsh ).isNotNull();
    assertThat( lsh ).isInstanceOf( SuperHero.class );
    lhc.getMembers().clear();
    em.remove( lh );
    em.remove( lsh );
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.backendtck.simpleentity.Hero

Copyright © 2018 www.massapicom. 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.