Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.DatabaseMetadata


          connection.commit();
          connection.setAutoCommit(true);
        }
        log.info("fetching database metadata");
        Dialect dialect = settings.getDialect();
        DatabaseMetadata meta = new DatabaseMetadata(connection, dialect);

        log.info("generating schema update script");
        String[] script = configuration.generateSchemaUpdateScript(dialect, meta);

        if (doUpdate) {
View Full Code Here


    }
    throw new JbpmException("no mapping found for table: " + tableName);
  }

  private TableMetadata getTableMetadata(Table table) throws SQLException {
    DatabaseMetadata databaseMetadata = new DatabaseMetadata(connection, settings.getDialect());
    return databaseMetadata.getTableMetadata(table.getName(),
        table.getSchema() == null ? settings.getDefaultSchemaName() : table.getSchema(),
        table.getCatalog() == null ? settings.getDefaultCatalogName() : table.getCatalog(),
        table.isQuoted());
  }
View Full Code Here

        exceptions.clear();

    try {

      DatabaseMetadata meta;
      try {
        log.info("fetching database metadata");
        connection = connectionProvider.getConnection();
        if ( !connection.getAutoCommit() ) {
          connection.commit();
          connection.setAutoCommit(true);
          autoCommitWasEnabled = false;
        }
        meta = new DatabaseMetadata(connection, dialect);
        stmt = connection.createStatement();
      }
      catch (SQLException sqle) {
                exceptions.add(sqle);
        log.error("could not get database metadata", sqle);
View Full Code Here

      hibernateTemplate.execute(
        new HibernateCallback<Object>() {
          public Object doInHibernate(Session session) throws HibernateException, SQLException {
            Connection con = session.connection();
            Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
            DatabaseMetadata metadata = new DatabaseMetadata(con, dialect);
            String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
            executeSchemaScript(con, sql);
            return null;
          }
        }
View Full Code Here

      hibernateTemplate.execute(
        new HibernateCallback<Object>() {
          public Object doInHibernate(Session session) throws HibernateException, SQLException {
            Connection con = session.connection();
            Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
            DatabaseMetadata metadata = new DatabaseMetadata(con, dialect, false);
            getConfiguration().validateSchema(dialect, metadata);
            return null;
          }
        }
      );
View Full Code Here

    hibernateTemplate.execute(
      new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException, SQLException {
          Connection con = session.connection();
          Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
          DatabaseMetadata metadata = new DatabaseMetadata(con, dialect);
          String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
          executeSchemaScript(con, sql);
          return null;
        }
      }
View Full Code Here

    hibernateTemplate.execute(
      new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException, SQLException {
          Connection con = session.connection();
          Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
          DatabaseMetadata metadata = new DatabaseMetadata(con, dialect);
          String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
          executeSchemaScript(con, sql);
          return null;
        }
      }
View Full Code Here

    hibernateTemplate.execute(
      new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException, SQLException {
          Connection con = session.connection();
          Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
          DatabaseMetadata metadata = new DatabaseMetadata(con, dialect);
          String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
          executeSchemaScript(con, sql);
          return null;
        }
      }
View Full Code Here

  public String validate() {
    Connection connection = null;
    try {
      connection = sessionFactoryBean.getDataSource().getConnection();
      DatabaseMetadata meta;
      logger.info("fetching database metadata");
      Configuration config = sessionFactoryBean.getConfiguration();
      Dialect dialect = Dialect.getDialect(sessionFactoryBean.getHibernateProperties());
      meta = new DatabaseMetadata(connection, dialect, false);
      return validateSchema(config, dialect, meta);
    } catch (SQLException sqle) {
      logger.error("could not get database metadata", sqle);
      throw new RuntimeException(sqle);
    } finally {
View Full Code Here

     
      if (migration) {
        try {
          final Connection connection = settings.getConnectionProvider().getConnection();
          try {
            final DatabaseMetadata metadata = new DatabaseMetadata(connection, settings.getDialect());
           
            writer.println("/* migration script */");
            printSQL(writer, hibernateConfig.generateSchemaUpdateScript(settings.getDialect(), metadata));
          } finally {
            connection.close();
View Full Code Here

TOP

Related Classes of org.hibernate.tool.hbm2ddl.DatabaseMetadata

Copyright © 2018 www.massapicom. 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.