From 915d6f9eeab7250aa8344c12c88c454b7d89dd93 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Mon, 29 Nov 2010 17:38:31 +0800 Subject: [PATCH] update StandardDialectResolver to return correct dialect for ms sql server --- .../org/hibernate/dialect/SQLServerDialect.java | 2 +- .../dialect/resolver/StandardDialectResolver.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index d456c2d688..43267ff72e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -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 */ diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java b/hibernate-core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java index 5d61dff205..82ba9d667e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java @@ -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();