HHH-6073 - Dialects cannot use the Thread Context ClassLoader with AS7, please change to use the

This commit is contained in:
Steve Ebersole 2011-04-06 11:31:14 -05:00
parent aad256c634
commit 7c4a9dac81
2 changed files with 8 additions and 4 deletions

View File

@ -80,12 +80,11 @@ public class StandardDialectResolver extends AbstractDialectResolver {
} }
if ( "Apache Derby".equals( databaseName ) ) { if ( "Apache Derby".equals( databaseName ) ) {
int driverVersionMajor = metaData.getDriverMajorVersion(); final int databaseMinorVersion = metaData.getDatabaseMinorVersion();
int driverVersionMinor = metaData.getDriverMinorVersion(); if ( databaseMajorVersion > 10 || ( databaseMajorVersion == 10 && databaseMinorVersion >= 6 ) ) {
if ( driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 ) ) {
return new DerbyTenSixDialect(); return new DerbyTenSixDialect();
} }
else if ( driverVersionMajor == 10 && driverVersionMinor == 5 ) { else if ( databaseMajorVersion == 10 && databaseMinorVersion == 5 ) {
return new DerbyTenFiveDialect(); return new DerbyTenFiveDialect();
} }
else { else {

View File

@ -22,6 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.dialect; package org.hibernate.dialect;
import javax.persistence.criteria.CriteriaBuilder;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
@ -122,6 +123,10 @@ public class Mocks {
return Integer.valueOf( majorVersion ); return Integer.valueOf( majorVersion );
} }
if ( "getDatabaseMinorVersion".equals( methodName ) ) {
return Integer.valueOf( minorVersion );
}
if ( "getConnection".equals( methodName ) ) { if ( "getConnection".equals( methodName ) ) {
return connectionProxy; return connectionProxy;
} }