Examples of SchemaUpdate


Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

    stat.execute("DROP TABLE \"SB\".\"TeamView\" ");
    stat.execute("CREATE VIEW \"SB\".\"TeamView\" AS SELECT \"iD\",name, name as duplicatedname FROM \"SB\".\"Team\"");
   

    // update schema, here should do nothing
    SchemaUpdate su = new SchemaUpdate(getCfg());
    su.execute(true,true);
   
    // we can run schema validation.
    // if schema validator chooses the bad db schema, then the testcase will fail (exception)
    SchemaValidator sv = new SchemaValidator(getCfg());
    sv.validate();
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

    Connection conn = session.connection();
    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

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

    builder.applySettings( configuration.getProperties() );
    ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
    integrateEnvers( configuration, serviceRegistry );

    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 {
       
        /* working with reflection as no idea what hibernate core version is used */
        try {
          Class schemaUpdateClass = SchemaUpdate.class;
         
          if (null != outputFileName) {
            Method setOutputFile = schemaUpdateClass.getMethod("setOutputFile",
                new Class[] {String.class});
            setOutputFile.invoke(update, new Object[] {new File(getOutputDirectory(),
                outputFileName).toString()});
                   
            log.debug("delimiter ='"+ delimiter + "'");
            Method setDelimiter = schemaUpdateClass.getMethod("setDelimiter",
                new Class[] {String.class});
            setDelimiter.invoke(update, new Object[] {delimiter});
           
            Method setFormat = schemaUpdateClass.getMethod("setFormat",
                new Class[] {boolean.class});
            setFormat.invoke(update, new Object[] {Boolean.valueOf(format)});
           
          }
         
          if (haltOnError) {
            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();
              log.warn("Error #" + i + ": ", element);

            }
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

         sessionFactory_ = SecurityHelper.doPrivilegedAction(new PrivilegedAction<SessionFactory>()
         {
            public SessionFactory run()
            {
               SessionFactory factory = conf_.buildSessionFactory();
               new SchemaUpdate(conf_).execute(false, true);
               return factory;
            }
         });
      }
      return sessionFactory_;
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

      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() ) {
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

         sessionFactory_ = SecurityHelper.doPrivilegedAction(new PrivilegedAction<SessionFactory>()
         {
            public SessionFactory run()
            {
               SessionFactory factory = conf_.buildSessionFactory();
               new SchemaUpdate(conf_).execute(false, true);
               return factory;
            }
         });
      }
      return sessionFactory_;
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

    if ( settings.isAutoCreateSchema() ) {
      new SchemaExport( serviceRegistry, cfg ).create( false, true );
    }
    if ( settings.isAutoUpdateSchema() ) {
      new SchemaUpdate( serviceRegistry, cfg ).execute( false, true );
    }
    if ( settings.isAutoValidateSchema() ) {
      new SchemaValidator( serviceRegistry, cfg ).validate();
    }
    if ( settings.isAutoDropSchema() ) {
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

      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() ) {
View Full Code Here

Examples of org.hibernate.tool.hbm2ddl.SchemaUpdate

    if ( settings.isAutoCreateSchema() ) {
      new SchemaExport( getJdbcServices(), cfg ).create( false, true );
    }
    if ( settings.isAutoUpdateSchema() ) {
      new SchemaUpdate( getJdbcServices(), cfg ).execute( false, true );
    }
    if ( settings.isAutoValidateSchema() ) {
      new SchemaValidator( getJdbcServices(), cfg ).validate();
    }
    if ( settings.isAutoDropSchema() ) {
View Full Code Here

Examples of ru.tehkode.permissions.backends.SchemaUpdate

    if (!baseDirectory.exists()) {
      baseDirectory.mkdirs();
    }

    this.permissionsFile = new File(baseDir, permissionFilename);
    addSchemaUpdate(new SchemaUpdate(1) {
      @Override
      public void performUpdate() {
        ConfigurationSection userSection = permissions.getConfigurationSection("users");
        if (userSection != null) {
          for (Map.Entry<String, Object> e : userSection.getValues(false).entrySet()) {
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.