Examples of SchemaExport


Examples of com.dotcms.repackage.net.sf.hibernate.tool.hbm2ddl.SchemaExport

      }else if(dialect.equals("com.dotcms.repackage.net.sf.hibernate.dialect.HSQLDialect")) {
          cfg.setProperty("hibernate.connection.driver_class", "org.h2.Driver");
          cfg.addResource("com/dotmarketing/beans/DotCMSId.hbm.xml");
      }

            SchemaExport sexp = new SchemaExport(cfg);
      sexp.setDelimiter(";");
      //DOTCMS-2915
      String basedir = this.getProject().getProperties().get("basedir").toString();
            File in = new File(basedir, "sql/sql.tmp");
      String[] x = dialect.split("[.]");
      String sqlFileName = ("sql/cms/dotcms_" + x[x.length - 1].replaceAll("Dialect", "") + ".sql").toLowerCase();
      sqlFileName = sqlFileName.replaceAll("sybase", "mssql-sybase").replaceAll("hsql", "h2");
            Logger.info(this, "writing file:" + sqlFileName);
            //DOTCMS-2915
            //File out = new File(sqlFileName);
            File out = new File(basedir, sqlFileName);
           
      boolean afterDrops = false;
      sexp.setOutputFile(in.getAbsolutePath());
      sexp.create(false, false);
      BufferedReader r = new BufferedReader(new FileReader(in));
      BufferedWriter wr = new BufferedWriter(new FileWriter(out));
      java.util.regex.Pattern p = java.util.regex.Pattern.compile("[a-zA-Z][A-Z,a-z,0-9]*\\s[A-Z,a-z,0-9]*\\s[a-zA-Z][A-Z,a-z,0-9]*\\s\\([a-zA-Z][A-Z,a-z,0-9]*.*");
      while (r.ready()) {
        String myLine = r.readLine().toLowerCase();
View Full Code Here

Examples of net.sf.hibernate.tool.hbm2ddl.SchemaExport

    node.setText(url);
    FileWriter w = new FileWriter(hibernateConfigFile);
    w.write(hibCfg.asXML());
    w.close();
    // Create hsqldb schema
    new SchemaExport(new Configuration().configure()).create(false, true);
  }
View Full Code Here

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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

   * 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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

              " 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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    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

Examples of org.hibernate.tool.hbm2ddl.SchemaExport

    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

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
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.