Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.TableMetadata


    Iterator iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted()

          );
        if ( tableInfo == null ) {
          script.add(
              table.sqlCreateString(
                  dialect,
                  mapping,
                  defaultCatalog,
                  defaultSchema
                )
            );
        }
        else {
          Iterator<String> subiter = table.sqlAlterStrings(
              dialect,
              mapping,
              tableInfo,
              defaultCatalog,
              defaultSchema
            );
          while ( subiter.hasNext() ) {
            script.add( subiter.next() );
          }
        }

        Iterator<String> comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema );
        while ( comments.hasNext() ) {
          script.add( comments.next() );
        }

      }
    }

    iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            table.getSchema(),
            table.getCatalog(),
            table.isQuoted()
          );

        if ( dialect.hasAlterTable() ) {
          Iterator subIter = table.getForeignKeyIterator();
          while ( subIter.hasNext() ) {
            ForeignKey fk = (ForeignKey) subIter.next();
            if ( fk.isPhysicalConstraint() ) {
              boolean create = tableInfo == null || (
                  tableInfo.getForeignKeyMetadata( fk ) == null && (
                      //Icky workaround for MySQL bug:
                      !( dialect instanceof MySQLDialect ) ||
                          tableInfo.getIndexMetadata( fk.getName() ) == null
                    )
                );
              if ( create ) {
                script.add(
                    fk.sqlCreateString(
                        dialect,
                        mapping,
                        defaultCatalog,
                        defaultSchema
                      )
                  );
              }
            }
          }
        }

        Iterator subIter = table.getIndexIterator();
        while ( subIter.hasNext() ) {
          final Index index = (Index) subIter.next();
          // Skip if index already exists
          if ( tableInfo != null && StringHelper.isNotEmpty( index.getName() ) ) {
            final IndexMetadata meta = tableInfo.getIndexMetadata( index.getName() );
            if ( meta != null ) {
              continue;
            }
          }
          script.add(
View Full Code Here


    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {


        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted());
        if ( tableInfo == null ) {
View Full Code Here

    Iterator iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       
        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted()

          );
        if ( tableInfo == null ) {
          script.add(
              table.sqlCreateString(
                  dialect,
                  mapping,
                  defaultCatalog,
                  defaultSchema
                )
            );
        }
        else {
          Iterator subiter = table.sqlAlterStrings(
              dialect,
              mapping,
              tableInfo,
              defaultCatalog,
              defaultSchema
            );
          while ( subiter.hasNext() ) {
            script.add( subiter.next() );
          }
        }

        Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema );
        while ( comments.hasNext() ) {
          script.add( comments.next() );
        }

      }
    }

    iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            table.getSchema(),
            table.getCatalog(),
            table.isQuoted()
          );

        if ( dialect.hasAlterTable() ) {
          Iterator subIter = table.getForeignKeyIterator();
          while ( subIter.hasNext() ) {
            ForeignKey fk = (ForeignKey) subIter.next();
            if ( fk.isPhysicalConstraint() ) {
              boolean create = tableInfo == null || (
                  tableInfo.getForeignKeyMetadata( fk.getName() ) == null && (
                      //Icky workaround for MySQL bug:
                      !( dialect instanceof MySQLDialect ) ||
                          tableInfo.getIndexMetadata( fk.getName() ) == null
                    )
                );
              if ( create ) {
                script.add(
                    fk.sqlCreateString(
View Full Code Here

    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted());
        if ( tableInfo == null ) {
View Full Code Here

    Iterator iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       
        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted()

          );
        if ( tableInfo == null ) {
          script.add(
              table.sqlCreateString(
                  dialect,
                  mapping,
                  defaultCatalog,
                  defaultSchema
                )
            );
        }
        else {
          Iterator subiter = table.sqlAlterStrings(
              dialect,
              mapping,
              tableInfo,
              defaultCatalog,
              defaultSchema
            );
          while ( subiter.hasNext() ) {
            script.add( subiter.next() );
          }
        }

        Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema );
        while ( comments.hasNext() ) {
          script.add( comments.next() );
        }

      }
    }

    iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            table.getSchema(),
            table.getCatalog(),
            table.isQuoted()
          );

        if ( dialect.hasAlterTable() ) {
          Iterator subIter = table.getForeignKeyIterator();
          while ( subIter.hasNext() ) {
            ForeignKey fk = (ForeignKey) subIter.next();
            if ( fk.isPhysicalConstraint() ) {
              boolean create = tableInfo == null || (
                  tableInfo.getForeignKeyMetadata( fk ) == null && (
                      //Icky workaround for MySQL bug:
                      !( dialect instanceof MySQLDialect ) ||
                          tableInfo.getIndexMetadata( fk.getName() ) == null
                    )
                );
              if ( create ) {
                script.add(
                    fk.sqlCreateString(
                        dialect,
                        mapping,
                        defaultCatalog,
                        defaultSchema
                      )
                  );
              }
            }
          }
        }
        Iterator subIter = table.getIndexIterator();
        while ( subIter.hasNext() ) {
          final Index index = (Index) subIter.next();
          // Skip if index already exists
          if ( tableInfo != null && StringHelper.isNotEmpty( index.getName() ) ) {
            final IndexMetadata meta = tableInfo.getIndexMetadata( index.getName() );
            if ( meta != null ) {
              continue;
            }
          }
          script.add(
View Full Code Here

    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted());
        if ( tableInfo == null ) {
View Full Code Here

    Iterator iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       
        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted()

          );
        if ( tableInfo == null ) {
          script.add(
              table.sqlCreateString(
                  dialect,
                  mapping,
                  defaultCatalog,
                  defaultSchema
                )
            );
        }
        else {
          Iterator subiter = table.sqlAlterStrings(
              dialect,
              mapping,
              tableInfo,
              defaultCatalog,
              defaultSchema
            );
          while ( subiter.hasNext() ) {
            script.add( subiter.next() );
          }
        }

        Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema );
        while ( comments.hasNext() ) {
          script.add( comments.next() );
        }

      }
    }

    iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            table.getSchema(),
            table.getCatalog(),
            table.isQuoted()
          );

        if ( dialect.hasAlterTable() ) {
          Iterator subIter = table.getForeignKeyIterator();
          while ( subIter.hasNext() ) {
            ForeignKey fk = (ForeignKey) subIter.next();
            if ( fk.isPhysicalConstraint() ) {
              boolean create = tableInfo == null || (
                  tableInfo.getForeignKeyMetadata( fk ) == null && (
                      //Icky workaround for MySQL bug:
                      !( dialect instanceof MySQLDialect ) ||
                          tableInfo.getIndexMetadata( fk.getName() ) == null
                    )
                );
              if ( create ) {
                script.add(
                    fk.sqlCreateString(
                        dialect,
                        mapping,
                        defaultCatalog,
                        defaultSchema
                      )
                  );
              }
            }
          }
        }

        Iterator subIter = table.getIndexIterator();
        while ( subIter.hasNext() ) {
          final Index index = (Index) subIter.next();
          // Skip if index already exists
          if ( tableInfo != null && StringHelper.isNotEmpty( index.getName() ) ) {
            final IndexMetadata meta = tableInfo.getIndexMetadata( index.getName() );
            if ( meta != null ) {
              continue;
            }
          }
          script.add(
View Full Code Here

    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted());
        if ( tableInfo == null ) {
View Full Code Here

    Iterator iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       
        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted()

          );
        if ( tableInfo == null ) {
          script.add(
              table.sqlCreateString(
                  dialect,
                  mapping,
                  defaultCatalog,
                  defaultSchema
                )
            );
        }
        else {
          Iterator<String> subiter = table.sqlAlterStrings(
              dialect,
              mapping,
              tableInfo,
              defaultCatalog,
              defaultSchema
            );
          while ( subiter.hasNext() ) {
            script.add( subiter.next() );
          }
        }

        Iterator<String> comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema );
        while ( comments.hasNext() ) {
          script.add( comments.next() );
        }

      }
    }

    iter = getTableMappings();
    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            table.getSchema(),
            table.getCatalog(),
            table.isQuoted()
          );

        if ( dialect.hasAlterTable() ) {
          Iterator subIter = table.getForeignKeyIterator();
          while ( subIter.hasNext() ) {
            ForeignKey fk = (ForeignKey) subIter.next();
            if ( fk.isPhysicalConstraint() ) {
              boolean create = tableInfo == null || (
                  tableInfo.getForeignKeyMetadata( fk ) == null && (
                      //Icky workaround for MySQL bug:
                      !( dialect instanceof MySQLDialect ) ||
                          tableInfo.getIndexMetadata( fk.getName() ) == null
                    )
                );
              if ( create ) {
                script.add(
                    fk.sqlCreateString(
                        dialect,
                        mapping,
                        defaultCatalog,
                        defaultSchema
                      )
                  );
              }
            }
          }
        }

        Iterator subIter = table.getIndexIterator();
        while ( subIter.hasNext() ) {
          final Index index = (Index) subIter.next();
          // Skip if index already exists
          if ( tableInfo != null && StringHelper.isNotEmpty( index.getName() ) ) {
            final IndexMetadata meta = tableInfo.getIndexMetadata( index.getName() );
            if ( meta != null ) {
              continue;
            }
          }
          script.add(
View Full Code Here

    while ( iter.hasNext() ) {
      Table table = (Table) iter.next();
      if ( table.isPhysicalTable() ) {
       

        TableMetadata tableInfo = databaseMetadata.getTableMetadata(
            table.getName(),
            ( table.getSchema() == null ) ? defaultSchema : table.getSchema(),
            ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(),
                table.isQuoted());
        if ( tableInfo == null ) {
View Full Code Here

TOP

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

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.