Package org.hibernate.ejb

Examples of org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate


  }

  ;

  private void buildConfiguration() {
    configuration = new Ejb3Configuration();
    configuration.addProperties( loadProperties() );
    if ( recreateSchema() ) {
      configuration.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    }
View Full Code Here


    assertEquals( "Wrong title", "Refactoring: Improving the Design of Existing Code", books.get( 0 ).getTitle() );
  }


  private void initHibernate() {
    Ejb3Configuration config = new Ejb3Configuration();
    config.configure( "hibernate-search-example", new HashMap() );
    emf = config.buildEntityManagerFactory();
    em = emf.createEntityManager();
  }
View Full Code Here

* @author Emmanuel Bernard
*/
public class ProgrammaticConfTest extends junit.framework.TestCase {

  public void testProgrammaticAPI() throws Exception {
    Ejb3Configuration conf = new Ejb3Configuration();
    conf.addAnnotatedClass( Cat.class );
    conf.addProperties(getProperties());
    EntityManagerFactory emf = conf.buildEntityManagerFactory();
    EntityManager em = emf.createEntityManager();
    Cat cat = new Cat();
    cat.setAge( 23 );
    cat.setDateOfBirth( new Date() );
    cat.setLength( 32 );
View Full Code Here

    em.getTransaction().rollback();
    emf.close();
  }

  public void testProgrammaticCfg() throws Exception {
    Ejb3Configuration conf = new Ejb3Configuration();
    conf.configure( "org/hibernate/ejb/test/ejb3configuration/hibernate.cfg.xml" );
    conf.addProperties(getProperties());
    EntityManagerFactory emf = conf.buildEntityManagerFactory();
    EntityManager em = emf.createEntityManager();
    Cat cat = new Cat();
    cat.setAge( 23 );
    cat.setDateOfBirth( new Date() );
    cat.setLength( 32 );
View Full Code Here

        assertEquals("Wrong title", "Refactoring: Improving the Design of Existing Code", books.get(0).getTitle());
    }


    private void initHibernate() {
        Ejb3Configuration config = new Ejb3Configuration();
        config.configure("hibernate-search-${packageInPathFormat}", new HashMap());
        emf = config.buildEntityManagerFactory();
        em = emf.createEntityManager();
    }
View Full Code Here

    assertEquals( "Wrong title", "Refactoring: Improving the Design of Existing Code", books.get( 0 ).getTitle() );
  }


  private void initHibernate() {
    Ejb3Configuration config = new Ejb3Configuration();
    config.configure( "hibernate-search-example", new HashMap() );
    emf = config.buildEntityManagerFactory();
    em = emf.createEntityManager();
  }
View Full Code Here

      System.out.println("Executed with " + Arrays.toString(args));
    final String dropScriptFileName = args[0] + File.separator + "drop-tables-ejbca4-" + args[1] + ".sql";
      final String createScriptFileName = args[0] + File.separator + "create-tables-ejbca4-" + args[1] + ".sql";
      final String createScriptFileNameNdb = args[0] + File.separator + "create-tables-ejbca4-" + args[1] + "-ndbcluster.sql";
      // Configure with our current persistence unit
      final Ejb3Configuration ejb3Configuration = new Ejb3Configuration().configure("ejbca-pu", null);
      final AnnotationConfiguration hibernateConfiguration = ejb3Configuration.getHibernateConfiguration();
    try {
      // Create drop script
        final String[] dropScript = hibernateConfiguration.generateDropSchemaScript(Dialect.getDialect(ejb3Configuration.getProperties()));
      StringBuilder sb = new StringBuilder();
      for (String line : dropScript) {
        sb.append(line);
        sb.append(";\n");
      }
      System.out.println("Writing drop script to " + dropScriptFileName);
      new FileOutputStream(dropScriptFileName).write(sb.toString().getBytes());
      // Create create script(s)
      final String[] createScript = hibernateConfiguration.generateSchemaCreationScript(Dialect.getDialect(ejb3Configuration.getProperties()));
      sb = new StringBuilder();
      for (String line : createScript) {
        // Format nicely, so it looks more like the old, manually created ones.
        if (line.startsWith("create")) {
          line = line.replaceAll("create table", "CREATE TABLE");
View Full Code Here

    /*
     * @see org.hibernate.ejb.HibernatePersistence#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
     */
    @Override
    public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
        Ejb3Configuration cfg = new Ejb3Configuration();
        Ejb3Configuration configured = cfg.configure(info, map);
        postProcessConfiguration(info, map, configured);
       
        return configured != null ? configured.buildEntityManagerFactory() : super.createContainerEntityManagerFactory(info, map);
    }
View Full Code Here

        }

        log.debug("Creating entity manager with the following configuration:");
        log.debug(properties);

        Ejb3Configuration configuration = new Ejb3Configuration();
        configuration.setProperties(properties);
        EntityManagerFactory factory = configuration.buildEntityManagerFactory();
        return factory;
    }
View Full Code Here

        } catch (ClassNotFoundException e) {
            throw new Exception("Postgres SQL Driver class could not be loaded. Missing class: " + driverClassName);
        }
        properties.put("hibernate.driver_class", driverClassName);
        properties.put("hibernate.connection.url", "jdbc:postgresql://localhost:5432/rhq");
        Ejb3Configuration configuration = new Ejb3Configuration();
        configuration.setProperties(properties);
        return configuration.buildEntityManagerFactory();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate

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.