Version: Hibernate 3.1.2 (but I think this applies to anything since 3.1)
Table.qualify has changed and is now incorrect! It does not handle the case for "catalog..tablename" that the old version does. Instead it outputs "catalog.tablename" which is not right (at least on SQL Server 2000).
Old version:
Code:
public static String qualify(String catalog, String schema, String table, char separator) {
StringBuffer qualifiedName = new StringBuffer();
if ( catalog != null ) {
qualifiedName.append( catalog );
qualifiedName.append( separator );
qualifiedName.append( schema != null ? schema : "" );
qualifiedName.append( separator );
}
else if ( schema != null ) {
qualifiedName.append( schema );
qualifiedName.append( separator );
}
qualifiedName.append( table );
eturn qualifiedName.toString();
}
New version:
Code:
public static String qualify(String catalog, String schema, String table) {
StringBuffer qualifiedName = new StringBuffer();
if ( catalog != null ) {
qualifiedName.append( catalog ).append( '.' );
}
if ( schema != null ) {
qualifiedName.append( schema ).append( '.' );
}
return qualifiedName.append( table ).toString();
}
As a side note to this, version 3.0 has a problem with the using a multicolumn usertype in the ORDER BY clause of HQL. It outputs:
ORDER BY (usertypeA_column1, usertypeA_column2)
In SQL Server 2000 the '(' and ')' are not allowed in an ORDER BY clause. I'm not sure if version 3.1+ fixes this yet as I uncovered the above Table.qualify bug first.