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 02d628a7a9..61cb4cd1d4 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 @@ -80,12 +80,11 @@ public class StandardDialectResolver extends AbstractDialectResolver { } if ( "Apache Derby".equals( databaseName ) ) { - int driverVersionMajor = metaData.getDriverMajorVersion(); - int driverVersionMinor = metaData.getDriverMinorVersion(); - if ( driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 ) ) { + final int databaseMinorVersion = metaData.getDatabaseMinorVersion(); + if ( databaseMajorVersion > 10 || ( databaseMajorVersion == 10 && databaseMinorVersion >= 6 ) ) { return new DerbyTenSixDialect(); } - else if ( driverVersionMajor == 10 && driverVersionMinor == 5 ) { + else if ( databaseMajorVersion == 10 && databaseMinorVersion == 5 ) { return new DerbyTenFiveDialect(); } else { diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/Mocks.java b/hibernate-core/src/test/java/org/hibernate/dialect/Mocks.java index 7eee5abfc7..82730478c0 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/Mocks.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/Mocks.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.dialect; +import javax.persistence.criteria.CriteriaBuilder; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -122,6 +123,10 @@ public class Mocks { return Integer.valueOf( majorVersion ); } + if ( "getDatabaseMinorVersion".equals( methodName ) ) { + return Integer.valueOf( minorVersion ); + } + if ( "getConnection".equals( methodName ) ) { return connectionProxy; }