Package org.hibernate.ejb

Examples of org.hibernate.ejb.HibernatePersistence


  }

  public void testOrm2() {
    PersistenceUnitInfoImpl pui = new PersistenceUnitInfoImpl( "orm2-test", "2.0" )
        .addMappingFileName( "org/hibernate/ejb/test/jee/valid-orm-2.xml" );
    HibernatePersistence hp = new HibernatePersistence();
    EntityManagerFactory emf = hp.createContainerEntityManagerFactory( pui, Collections.EMPTY_MAP );
    emf.getMetamodel().entity( org.hibernate.ejb.test.pack.defaultpar.Lighter.class ); // exception if not entity
  }
View Full Code Here


  }

  public void testInvalidOrm1() {
    PersistenceUnitInfoImpl pui = new PersistenceUnitInfoImpl( "invalid-orm1-test", "1.0" )
        .addMappingFileName( "org/hibernate/ejb/test/jee/invalid-orm-1.xml" );
    HibernatePersistence hp = new HibernatePersistence();
    try {
      hp.createContainerEntityManagerFactory( pui, Collections.EMPTY_MAP );
      fail( "expecting 'invalid content' error" );
    }
    catch ( InvalidMappingException expected ) {
      // expected condition
    }
View Full Code Here

    File current = new File(".");
    File sub = new File(current, "puroot");
    sub.mkdir();
    PersistenceUnitInfoImpl info = new PersistenceUnitInfoImpl( sub.toURI().toURL(), new String[]{} );
    try {
      new HibernatePersistence().createContainerEntityManagerFactory( info, null );
      fail( "FakeDatasource should have been used" );
    }
    catch (FakeDataSourceException fde) {
      //success
    }
View Full Code Here

  public JPATestCase(String name) {
    super( name );
  }

  public void setUp() {
    factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
  }
View Full Code Here

  public JPATestCase(String name) {
    super( name );
  }

  public void setUp() {
    factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
  }
View Full Code Here

    Map<String, String> properties = new HashMap<String, String>();
    properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
    properties.put("javax.persistence.validation.mode", "none");

    EntityManagerFactory emf = new HibernatePersistence().createEntityManagerFactory(persistenceUnits.iterator().next(), properties);
    EntityManager em = emf.createEntityManager();
    return em;
  }
View Full Code Here

  public JPATestCase(String name) {
    super( name );
  }

  public void setUp() {
    factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
  }
View Full Code Here

   */
  static class HibernateOnlyPersistenceProviderResolver implements PersistenceProviderResolver {

    @Override
    public List<PersistenceProvider> getPersistenceProviders() {
      return Arrays.<PersistenceProvider> asList(new HibernatePersistence());
    }
View Full Code Here

  public JPATestCase(String name) {
    super( name );
  }

  public void setUp() {
    factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
  }
View Full Code Here

        .addProperty( Environment.JTA_PLATFORM, JBossStandAloneJtaPlatform.class.getName() )
            //I don't pool connections by JTA transaction. Leave the work to Hibernate Core
        .addProperty( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.AFTER_TRANSACTION.toString() )
        .addProperty( "hibernate.search.default.directory_provider", "ram" )
        .create();
    final HibernatePersistence hp = new HibernatePersistence();
    factory = hp.createContainerEntityManagerFactory( unitInfo, new HashMap() );

  }
View Full Code Here

TOP

Related Classes of org.hibernate.ejb.HibernatePersistence

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.