There are a couple of things (IMHO) "wrong" with the SQLServerDialect that comes with Hibernate 2.1.8 plus I wanted to use Unicode characters so I created this SQLServer2000UnicodeDialect.
SQL Server 2000 supports BIGINT and BIT which the 2.1.8 SQLServerDialect does not, maybe this was just a left over from Sybase or maybe based on an earlier version of SQL Server.
I would hope that this gets changed in future releases of Hibernate.
The other thing in this dialect is the use of nvarchar, nchar, and ntext to support Unicode characters.
Note I also use and highly recommend the jTDS driver when using SQL Server.
Code:
package my.hibernate.dialect;
import java.sql.Types;
import net.sf.hibernate.dialect.SQLServerDialect;
public class SQLServer2000UnicodeDialect extends SQLServerDialect
{
public SQLServer2000UnicodeDialect ()
{
super();
// Use Unicode Characters
registerColumnType( Types.VARCHAR, "nvarchar($l)" );
registerColumnType( Types.CHAR, "nchar(1)" );
registerColumnType( Types.CLOB, "ntext" );
// Microsoft SQL Server 2000 supports bigint and bit
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.BIT, "bit" );
// From SQLServerDialect.java,v 1.10 2005/02/22 14:05:52
registerColumnType( Types.VARBINARY, "image" );
registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
}
}
I donate the following to the Hibernate project.
Thanks for the great work you do.
[/b]