Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate.execute()


   * @param export
   */
  public void updateSchema(Configuration cfg, boolean script, boolean export) {
    try {
      SchemaUpdate exp = new SchemaUpdate(cfg);
      exp.execute(script, export);
    } catch (HibernateException ex) {
      log.fatal("Cant't update database schema: " + ex.getMessage(), ex);
      return;
    }
  }
View Full Code Here


    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
    su.execute(true,true);
   
    // we can run schema validation. Note that in the setUp method a *wrong* table
    // has been created with different column names
    // if schema validator chooses the bad db schema, then the testcase will fail (exception)
    SchemaValidator sv = new SchemaValidator(getCfg());
View Full Code Here

    Statement stat = conn.createStatement();
    stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
   
    // update schema
    SchemaUpdate su = new SchemaUpdate(getCfg());
    su.execute(true,true);
   
    // we can run schema validation. Note that in the setUp method a *wrong* table
    // has been created with different column names
    // if schema validator chooses the bad db schema, then the testcase will fail (exception)
    SchemaValidator sv = new SchemaValidator(getCfg());
View Full Code Here

    Configuration v1cfg = new Configuration();
    v1cfg.addResource( resource1 );
    new SchemaExport( v1cfg ).execute( false, true, true, false );

    SchemaUpdate v1schemaUpdate = new SchemaUpdate( v1cfg );
    v1schemaUpdate.execute( true, true );

    assertEquals( 0, v1schemaUpdate.getExceptions().size() );

    Configuration v2cfg = new Configuration();
    v2cfg.addResource( resource2 );
View Full Code Here

    Configuration v2cfg = new Configuration();
    v2cfg.addResource( resource2 );

    SchemaUpdate v2schemaUpdate = new SchemaUpdate( v2cfg );
    v2schemaUpdate.execute( true, true );
    assertEquals( 0, v2schemaUpdate.getExceptions().size() );

  }

}
View Full Code Here

    Configuration v1cfg = new Configuration();
    v1cfg.addResource( resource1 );
    new SchemaExport( v1cfg ).execute( false, true, true, false );

    SchemaUpdate v1schemaUpdate = new SchemaUpdate( v1cfg );
    v1schemaUpdate.execute( true, true );

    assertEquals( 0, v1schemaUpdate.getExceptions().size() );

    Configuration v2cfg = new Configuration();
    v2cfg.addResource( resource2 );
View Full Code Here

    Configuration v2cfg = new Configuration();
    v2cfg.addResource( resource2 );

    SchemaUpdate v2schemaUpdate = new SchemaUpdate( v2cfg );
    v2schemaUpdate.execute( true, true );
    assertEquals( 0, v2schemaUpdate.getExceptions().size() );
    new SchemaExport( v2cfg ).execute( false, true, true, false );
  }

}
View Full Code Here

    if (schemaUpdate) {
      SchemaUpdate update = new SchemaUpdate(serviceRegistry, configuration);
     
      // classic schemaupdate execution, will work with all releases
      if(outputFileName == null && delimiter == null && haltOnError && format)
        update.execute(scriptToConsole, exportToDatabase);

      // at least one of the parameter unmanaged by
      // hibernate core prior versions is set
      else {
       
View Full Code Here

            Method setHaltOnError = schemaUpdateClass.getMethod("setHaltOnError",
                new Class[] {boolean.class});
            setHaltOnError.invoke(update, new Object[] {Boolean.valueOf(haltOnError)});
          }
         
          update.execute(scriptToConsole, exportToDatabase);
          if (!update.getExceptions().isEmpty()) {
            int i = 1;
            for (Iterator iterator = update.getExceptions().iterator(); iterator
                .hasNext(); i++) {
              Throwable element = (Throwable) iterator.next();
View Full Code Here

        Configuration cfg = createSpringPackageScanningConfiguration(enhancedId);
        cfg.setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:TESTDB2" + currentTimeMillis);

        SchemaUpdate update = new SchemaUpdate(cfg);
        update.execute(true, true);

        diffResult = liquibase.diff(database, database2, compareControl);

        ignoreDatabaseChangeLogTable(diffResult);
        ignoreConversionFromFloatToDouble64(diffResult);
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.