Package org.hibernate.ejb

Examples of org.hibernate.ejb.Ejb3Configuration$ScanningContext


    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


     *
     * @param args
     *            Arguments - not used.
     */
    public static void main(final String[] args) {
        Ejb3Configuration config = new Ejb3Configuration(); // reads persistence.xml
        config.configure("default", null);
        config.buildEntityManagerFactory(); // connects and validates
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @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() : null;
    }
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

  }

  ;

  private void buildConfiguration() {
    configuration = new Ejb3Configuration();
    configuration.addProperties( loadProperties() );
    if ( recreateSchema() ) {
      configuration.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    }
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 );
    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" );
    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-example", new HashMap());
        emf = config.buildEntityManagerFactory();
        em = emf.createEntityManager();
    }
View Full Code Here

        exporter.createDerbySchema();
        exporter.createMySqlSchema();
    }

  private void createDerbySchema() {
    Configuration cfg = new Ejb3Configuration().configure("in-memory-test-db", null).getHibernateConfiguration();
    new SchemaExport(cfg)
        .setOutputFile("schema-export-derby.sql")
        .setDelimiter(";")
        .setFormat(true)
        .create(false, true);
View Full Code Here

        .setFormat(true)
        .create(false, true);
  }

  private void createMySqlSchema() {
    Configuration cfg = new Ejb3Configuration().configure("in-memory-test-db", null).getHibernateConfiguration();
    // override the Derby dialect used in tests
    cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    new SchemaExport(cfg)
        .setOutputFile("schema-export-mysql.sql")
        .setDelimiter(";")
View Full Code Here

TOP

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

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.