update StandardDialectResolver to return correct dialect for ms sql server

This commit is contained in:
Strong Liu 2010-11-29 17:38:31 +08:00
parent 01dd9a44e5
commit 915d6f9eea
2 changed files with 13 additions and 3 deletions

View File

@ -32,7 +32,7 @@ import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* A dialect for Microsoft SQL Server 2000 and 2005
* A dialect for Microsoft SQL Server 2000
*
* @author Gavin King
*/

View File

@ -38,6 +38,8 @@ import org.hibernate.dialect.DerbyDialect;
import org.hibernate.dialect.Ingres10Dialect;
import org.hibernate.dialect.Ingres9Dialect;
import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.dialect.SQLServer2008Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.InformixDialect;
import org.hibernate.dialect.DB2Dialect;
@ -88,7 +90,6 @@ public class StandardDialectResolver extends AbstractDialectResolver{
}
return new IngresDialect();
case 10:
log.warn( "Ingres " + databaseMajorVersion + " is not yet fully supported; using Ingres 9.3 dialect" );
return new Ingres10Dialect();
default:
log.warn( "Unknown Ingres major version [" + databaseMajorVersion + "] using Ingres 9.2 dialect" );
@ -97,6 +98,16 @@ public class StandardDialectResolver extends AbstractDialectResolver{
}
if ( databaseName.startsWith( "Microsoft SQL Server" ) ) {
switch ( databaseMajorVersion ) {
case 8:
return new SQLServerDialect();
case 9:
return new SQLServer2005Dialect();
case 10:
return new SQLServer2008Dialect();
default:
log.warn( "Unknown Microsoft SQL Server major version [" + databaseMajorVersion + "] using SQL Server 2000 dialect" );
}
return new SQLServerDialect();
}
@ -119,7 +130,6 @@ public class StandardDialectResolver extends AbstractDialectResolver{
if ( "Oracle".equals( databaseName ) ) {
switch ( databaseMajorVersion ) {
case 11:
log.warn( "Oracle 11g is not yet fully supported; using 10g dialect" );
return new Oracle10gDialect();
case 10:
return new Oracle10gDialect();