Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.SchemaExport


  public void setProperty(String property, String value) {
    properties.setProperty(property, value);
  }

  public void dropSchema() {
    new SchemaExport( buildConfiguration() ).drop(false, true);
  }
View Full Code Here


  public void dropSchema() {
    new SchemaExport( buildConfiguration() ).drop(false, true);
  }

  public void createSchema() {
    new SchemaExport( buildConfiguration() ).create(false, true);
  public String getName() {
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

    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

public class CreateDataBaseTableByHibernateConfigFile {
 
 
  public static void main(String[] args) {
    Configuration configuration = new Configuration().configure().setNamingStrategy(new ImprovedNamingStrategy());
    SchemaExport export = new SchemaExport(configuration);
   
    export.setFormat(false);
    export.setOutputFile("src/test/resources/data/h2/create-table-new.sql");
    export.create(true, false);
  }
View Full Code Here

public class CreateTestInitializeDataBaseSqlFile {
 
  public static void main(String[] args) {
   
    Configuration configuration = new Configuration().configure().setNamingStrategy(new ImprovedNamingStrategy());
    SchemaExport export = new SchemaExport(configuration);
   
    export.setFormat(false);
    export.setOutputFile("src/test/resources/h2schma.sql");
    export.create(true, false);
  }
View Full Code Here

    SessionFactoryRegistry.INSTANCE.addSessionFactory( uuid, name, this, serviceRegistry.getService( JndiService.class ) );

    LOG.debugf( "Instantiated session factory" );

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

    currentSessionContext = buildCurrentSessionContext();
View Full Code Here

    SessionFactoryRegistry.INSTANCE.addSessionFactory( uuid, name, this, serviceRegistry.getService( JndiService.class ) );

    LOG.debugf("Instantiated session factory");

    if ( settings.isAutoCreateSchema() ) {
      new SchemaExport( metadata )
          .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) )
          .create( false, true );
    }
    /*
    if ( settings.isAutoUpdateSchema() ) {
      new SchemaUpdate( metadata ).execute( false, true );
    }
    if ( settings.isAutoValidateSchema() ) {
      new SchemaValidator( metadata ).validate();
    }
    */
    if ( settings.isAutoDropSchema() ) {
      schemaExport = new SchemaExport( metadata )
          .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) );
    }

    currentSessionContext = buildCurrentSessionContext();

View Full Code Here

  public static Configuration getConfiguration(SessionFactory sessionFactory) {
    return (Configuration) configurations.get(sessionFactory);
  }

  public static SchemaExport createSchemaExport(SessionFactory sessionFactory) {
    return new SchemaExport(getConfiguration(sessionFactory));
  }
View Full Code Here

    List<? extends Exception> exceptions;
    try {
      Configuration configuration = getConfiguration();
      if ("drop".equalsIgnoreCase(action)) {
        SchemaExport schemaExport = getSchemaExport(configuration);
        schemaExport.drop(false, false);
        exceptions = CollectionUtil.checkList(schemaExport.getExceptions(), Exception.class);
      }
      else if ("create".equalsIgnoreCase(action)) {
        SchemaExport schemaExport = getSchemaExport(configuration);
        schemaExport.execute(false, false, false, true);
        exceptions = CollectionUtil.checkList(schemaExport.getExceptions(), Exception.class);
      }
      else if ("update".equalsIgnoreCase(action)) {
        JbpmSchemaUpdate schemaUpdate = getSchemaUpdate(configuration);
        schemaUpdate.execute(false, false);
        exceptions = schemaUpdate.getExceptions();
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.