Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.SchemaExport


  protected boolean recreateSchema() {
    return true;
  }

  protected void runSchemaGeneration() {
    SchemaExport export = new SchemaExport( getJdbcServices(), cfg );
    export.create( true, true );
  }
View Full Code Here


    SchemaExport export = new SchemaExport( getJdbcServices(), cfg );
    export.create( true, true );
  }

  protected void runSchemaDrop() {
    SchemaExport export = new SchemaExport( getJdbcServices(), cfg );
    export.drop( true, true );
  }
View Full Code Here

        return action;
    }

    private void createDatabase(Configuration cfg) {
        try {
            new SchemaExport(cfg).create(false, true);
            log.info("Successfully created DB");
        } catch (HibernateException e) {
            log.error("DB Error: " + CREATION_ERROR + " !", e);
            throw new RuntimeException("DB Error: " + CREATION_ERROR + " ! " + e.getMessage());
        }
View Full Code Here

    SessionFactoryObjectFactory.addInstance(uuid, name, this, properties);

    log.debug("instantiated session factory");

    if ( settings.isAutoCreateSchema() ) {
      new SchemaExport( cfg, settings ).create( false, true );
    }
    if ( settings.isAutoUpdateSchema() ) {
      new SchemaUpdate( cfg, settings ).execute( false, true );
    }
    if ( settings.isAutoValidateSchema() ) {
      new SchemaValidator( cfg, settings ).validate();
    }
    if ( settings.isAutoDropSchema() ) {
      schemaExport = new SchemaExport( cfg, settings );
    }

    if ( settings.getTransactionManagerLookup()!=null ) {
      log.debug("obtaining JTA TransactionManager");
      transactionManager = settings.getTransactionManagerLookup().getTransactionManager(properties);
View Full Code Here

        return action;
    }

    private void createDatabase(Configuration cfg) {
        try {
            new SchemaExport(cfg).create(false, true);
            log.info("Successfully created DB");
        } catch (HibernateException e) {
            log.error("DB Error: " + CREATION_ERROR + " !", e);
            throw new RuntimeException("DB Error: " + CREATION_ERROR + " ! " + e.getMessage());
        }
View Full Code Here

public class HibernateManagerTest extends TestCase {

  public void testManagerFactory() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
      Manager<Poll> manager = managers.forClass(Poll.class);     
      assertEquals(HibernateManager.class, manager.getClass());
View Full Code Here

  }
 
  public void testPk() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
      Manager<Poll> manager = managers.forClass(Poll.class);     
      assertEquals(HibernateManager.class, manager.getClass());
View Full Code Here

  }
 
  public void testSearch() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
      Manager<Poll> manager = managers.forClass(Poll.class);     
     
View Full Code Here

  }
 
  public void testPropertySearch() throws Exception {
    Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
      Manager<Poll> manager = managers.forClass(Poll.class);     
     
View Full Code Here

  }
 
  public void testMultipleJoinSearches() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
      Manager<Poll> manager = managers.forClass(Poll.class);     
     
View Full Code Here

TOP

Related Classes of org.hibernate.tool.hbm2ddl.SchemaExport

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.