diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java index 1446df48a8..39fe7b2b14 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java @@ -40,6 +40,7 @@ import org.hibernate.dialect.InformixDialect; import org.hibernate.dialect.Ingres10Dialect; import org.hibernate.dialect.Ingres9Dialect; import org.hibernate.dialect.IngresDialect; +import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle8iDialect; @@ -82,6 +83,9 @@ public class StandardDialectResolver extends AbstractDialectResolver { } if ( "MySQL".equals( databaseName ) ) { + if (databaseMajorVersion >= 5 ) { + return new MySQL5Dialect(); + } return new MySQLDialect(); } diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/resolver/DialectFactoryTest.java b/hibernate-core/src/test/java/org/hibernate/dialect/resolver/DialectFactoryTest.java index 4d763ff5a5..a2290f4eb7 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/resolver/DialectFactoryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/resolver/DialectFactoryTest.java @@ -45,6 +45,7 @@ import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.InformixDialect; import org.hibernate.dialect.IngresDialect; import org.hibernate.dialect.Mocks; +import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle8iDialect; @@ -128,6 +129,7 @@ public class DialectFactoryTest extends BaseUnitTestCase { testDetermination( "HSQL Database Engine", HSQLDialect.class, resolver ); testDetermination( "H2", H2Dialect.class, resolver ); testDetermination( "MySQL", MySQLDialect.class, resolver ); + testDetermination( "MySQL", 5, 0, MySQL5Dialect.class, resolver ); testDetermination( "PostgreSQL", PostgreSQL81Dialect.class, resolver ); testDetermination( "PostgreSQL", 8, 2, PostgreSQL82Dialect.class, resolver ); testDetermination( "Apache Derby", 10, 4, DerbyDialect.class, resolver );