Examples of SchemaExport


Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    } else {
      ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
      builder.applySettings(configuration.getProperties());
      ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
      serviceRegistry.getService( JdbcServices.class );
      SchemaExport export = new SchemaExport(serviceRegistry, 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) {
        // not just drop or create but both!
        export.execute(scriptToConsole, exportToDatabase, false, false);
      } else {
        export.execute(scriptToConsole, exportToDatabase, drop, create);
      }
    }
   
  }
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

  protected boolean recreateSchema() {
    return true;
  }

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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

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

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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

        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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    // get the hibernate Configuration
    Configuration configuration = AntHelper.getConfiguration(cfg,properties);

    JbpmSchema jbpmSchema = new JbpmSchema(configuration);

    SchemaExport schemaExport = new SchemaExport(configuration);
    if (output!=null) schemaExport.setOutputFile(output);
    if (delimiter!=null) schemaExport.setDelimiter(delimiter);

    StringTokenizer tokenizer = new StringTokenizer(actions, ",");
    while (tokenizer.hasMoreTokens()) {
      String action = tokenizer.nextToken();

      if ("drop".equalsIgnoreCase(action)) {
        schemaExport.drop(!quiet, !text);

      } else if ("create".equalsIgnoreCase(action)) {
        schemaExport.create(!quiet, !text);
       
      } else if ("clean".equalsIgnoreCase(action)) {
        jbpmSchema.cleanSchema();
      }
    }
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    try {
      new File(dir).mkdirs();
      saveSqlScript(dir+"/"+prefix+".drop.sql", getDropSql());
      saveSqlScript(dir+"/"+prefix+".create.sql", getCreateSql());
      saveSqlScript(dir+"/"+prefix+".clean.sql", getCleanSql());
      new SchemaExport(configuration)
        .setDelimiter(getSqlDelimiter())
        .setOutputFile(dir+"/"+prefix+".drop.create.sql")
        .create(true, false);
    } catch (Exception e) {
      throw new JbpmException("couldn't generate scripts", e);
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

  }

  public synchronized SchemaExport getSchemaExport() {
    if (schemaExport==null) {
      log.debug("creating schema export");
      schemaExport = new SchemaExport(getConfiguration());
    }
    return schemaExport;
  }
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

  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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

                        .getResources("classpath*:mappings.hbm.xml");
                for (Resource resource : resources) {
                    cfg.addInputStream(resource.getInputStream());
                }

                SchemaExport export = new SchemaExport(cfg);
                export.drop(true, true);
                export.create(true, true);
            } catch (Exception e) {
                throw new BeanInitializationException(null, e);
            }
        }
        return bean;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.