HHH-4572) check if the connection supports jdbc4 before looking for the createClob method
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17975 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
66b84aec0c
commit
8da29593d2
|
@ -24,6 +24,8 @@
|
||||||
package org.hibernate.engine.jdbc;
|
package org.hibernate.engine.jdbc;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -67,6 +69,18 @@ public class JdbcSupportLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
try {
|
||||||
|
DatabaseMetaData meta = jdbcConnection.getMetaData();
|
||||||
|
// if the jdbc driver version is less than 4, it shouldn't have createClob
|
||||||
|
if ( meta.getJDBCMajorVersion() < 4 ) {
|
||||||
|
log.info("Disabling contextual LOB creation as JDBC driver version (" +
|
||||||
|
meta.getJDBCMajorVersion()+
|
||||||
|
") is less than 4");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(SQLException eat) { /* ignore exception and continue */}
|
||||||
|
|
||||||
Class connectionClass = Connection.class;
|
Class connectionClass = Connection.class;
|
||||||
Method createClobMethod = connectionClass.getMethod( "createClob", NO_ARG_SIG );
|
Method createClobMethod = connectionClass.getMethod( "createClob", NO_ARG_SIG );
|
||||||
if ( createClobMethod.getDeclaringClass().equals( Connection.class ) ) {
|
if ( createClobMethod.getDeclaringClass().equals( Connection.class ) ) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue