Package org.hibernate.tool.hbm2ddl

Examples of org.hibernate.tool.hbm2ddl.ColumnMetadata


  public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
      Column col = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

      if ( columnInfo == null ) {
        throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
      }
      else {
        final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
            .startsWith( columnInfo.getTypeName().toLowerCase() )
            || columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
        if ( !typesMatch ) {
          throw new HibernateException(
              "Wrong column type in " +
              Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
              " for column " + col.getName() +
              ". Found: " + columnInfo.getTypeName().toLowerCase() +
              ", expected: " + col.getSqlType( dialect, mapping )
          );
        }
      }
    }
View Full Code Here


    Iterator iter = getColumnIterator();
    List results = new ArrayList();
    while ( iter.hasNext() ) {
      Column column = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( column.getName() );

      if ( columnInfo == null ) {
        // the column doesnt exist at all.
        StringBuffer alter = new StringBuffer( root.toString() )
            .append( ' ' )
View Full Code Here

  public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
      Column col = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

      if ( columnInfo == null ) {
        throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
      }
      else {
        final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
            .startsWith( columnInfo.getTypeName().toLowerCase() )
            || columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
        if ( !typesMatch ) {
          throw new HibernateException(
              "Wrong column type in " +
              Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
              " for column " + col.getName() +
              ". Found: " + columnInfo.getTypeName().toLowerCase() +
              ", expected: " + col.getSqlType( dialect, mapping )
          );
        }
      }
    }
View Full Code Here

    List results = new ArrayList();
   
    while ( iter.hasNext() ) {
      Column column = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( column.getName() );

      if ( columnInfo == null ) {
        // the column doesnt exist at all.
        StringBuilder alter = new StringBuilder( root.toString() )
            .append( ' ' )
View Full Code Here

  public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
      Column col = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

      if ( columnInfo == null ) {
        throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
      }
      else {
        final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
            .startsWith( columnInfo.getTypeName().toLowerCase() )
            || columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
        if ( !typesMatch ) {
          throw new HibernateException(
              "Wrong column type in " +
              Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
              " for column " + col.getName() +
              ". Found: " + columnInfo.getTypeName().toLowerCase() +
              ", expected: " + col.getSqlType( dialect, mapping )
          );
        }
      }
    }
View Full Code Here

    Iterator iter = getColumnIterator();
    List results = new ArrayList();
    while ( iter.hasNext() ) {
      Column column = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( column.getName() );

      if ( columnInfo == null ) {
        // the column doesnt exist at all.
        StringBuffer alter = new StringBuffer( root.toString() )
            .append( ' ' )
View Full Code Here

  public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
      Column col = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

      if ( columnInfo == null ) {
        throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
      }
      else {
        final boolean typesMatch = col.getSqlType( dialect, mapping )
            .startsWith( columnInfo.getTypeName().toLowerCase() )
            || columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
        if ( !typesMatch ) {
          throw new HibernateException(
              "Wrong column type: " + col.getName() +
                  ", expected: " + col.getSqlType( dialect, mapping )
          );
View Full Code Here

    Iterator iter = getColumnIterator();
    List results = new ArrayList();
    while ( iter.hasNext() ) {
      Column column = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( column.getName() );

      if ( columnInfo == null ) {
        // the column doesnt exist at all.
        StringBuffer alter = new StringBuffer( root.toString() )
            .append( ' ' )
View Full Code Here

    Iterator iter = getColumnIterator();
    List results = new ArrayList();
    while ( iter.hasNext() ) {
      Column column = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( column.getName() );

      if ( columnInfo == null ) {
        // the column doesnt exist at all.
        StringBuffer alter = new StringBuffer( root.toString() )
            .append( ' ' )
View Full Code Here

  public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
    Iterator iter = getColumnIterator();
    while ( iter.hasNext() ) {
      Column col = (Column) iter.next();

      ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

      if ( columnInfo == null ) {
        throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
      }
      else {
        final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
            .startsWith( columnInfo.getTypeName().toLowerCase() )
            || columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
        if ( !typesMatch ) {
          throw new HibernateException(
              "Wrong column type in " +
              Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
              " for column " + col.getName() +
              ". Found: " + columnInfo.getTypeName().toLowerCase() +
              ", expected: " + col.getSqlType( dialect, mapping )
          );
        }
      }
    }
View Full Code Here

TOP

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

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.