Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.SchemaExport


   * Setup OLAT database. This will drop all tables first if available.
   * @throws Exception
   */
  public static void createTables() throws Exception {
    log.info("Creating tables");
    new SchemaExport(cf).create(false, true); // set first bolean to true for debugging.
  }
View Full Code Here


   * Drop all OLAT tables
   * @throws Exception
   */
  public static void dropTables() throws Exception {
    log.info("Dropping tables");
    new SchemaExport(cf).drop(false, true);
  }
View Full Code Here

    String outputFile = "database/setupDatabase.sql";

    boolean script = true// write DDL
    boolean export = false; // don't update databse   
    try {
      SchemaExport se = new SchemaExport(cf);
      se.setOutputFile(outputFile);
      se.setDelimiter(";");
      se.create(script, export);
    } catch (Exception e) {
      log.error("DDL export to file failed: Reason: ", e);
    }
  }
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

              " either update hibernate3.jar or don't used the involved parameters", e );
        }
      }

    } else {
      SchemaExport export = new SchemaExport(configuration);
      if (null != outputFileName) {
        export.setOutputFile(new File(getOutputDirectory(),
            outputFileName).toString());
      }
      if (null != delimiter) {
        export.setDelimiter(delimiter);
      }
      export.setHaltOnError(haltOnError);
      export.setFormat(format);
      if (drop && create) {
        export.create(scriptToConsole, exportToDatabase);
      } else {
        export.execute(scriptToConsole, exportToDatabase, drop, create);
      }
    }
   
  }
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

    if (!patchSchema.exists()) {
      patchSchema.getParentFile().mkdirs();
      patchSchema.createNewFile();
    }
   
    SchemaExport export = new SchemaExport(cfg);
    export.setDelimiter(";");
    export.setOutputFile(patchSchema.getAbsolutePath());
    // Generates alter table drops which should be removed at version 0
    export.execute(true, false, false, false);

    log.info("Schema export complete. Results in '{}'",patchSchema.getAbsolutePath());
  }
View Full Code Here

        properties
    );


    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

    if ( debugEnabled ) {
      LOG.debug("Instantiated session factory");
    }

    if ( settings.isAutoCreateSchema() ) {
      new SchemaExport( metadata )
          .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) )
          .create( false, true );
    }

    if ( settings.isAutoDropSchema() ) {
      schemaExport = new SchemaExport( metadata )
          .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) );
    }

    currentSessionContext = buildCurrentSessionContext();
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

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.