Package org.hibernate.tool.hbm2ddl

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


    if (schemaUpdate) {
      SchemaUpdate update = new SchemaUpdate(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

      builder.applySettings(configuration.getProperties());
      SchemaUpdate update = new SchemaUpdate(builder.buildServiceRegistry(), 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

    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() );
   
    new SchemaExport( v2cfg ).drop( false, true );

  }
View Full Code Here

  public static void main(String[] args) {
    Configuration config = new Configuration();
    config.configure();
    SchemaUpdate su = new SchemaUpdate(config);
    su.execute(true, true);
  }
}
View Full Code Here

  private static void update() {
    Configuration config = new Configuration();
    config.configure();
    SchemaUpdate su = new SchemaUpdate(config);
    su.execute(true, true);
  }
}
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.