hibernate/hibernate-orm · error · HibernateException

The JDBC driver does not implement the method: ${method}

Error message

The JDBC driver does not implement the method: ${method}

What it means

SerializableBlobProxy.invoke() forwards every Blob method to the wrapped driver Blob via reflection. When the driver's Blob implementation simply does not implement the requested method (typical for pre-JDBC-4 drivers), reflection raises AbstractMethodError, which the proxy converts to HibernateException("The JDBC driver does not implement the method: ...") naming the failing method. It is a driver-capability problem, not a data problem.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/proxy/SerializableBlobProxy.java:63

	public Blob getWrappedBlob() {
		if ( blob == null ) {
			throw new IllegalStateException( "Blobs may not be accessed after serialization" );
		}
		else {
			return blob;
		}
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		if ( "getWrappedBlob".equals( method.getName() ) ) {
			return getWrappedBlob();
		}
		try {
			return method.invoke( getWrappedBlob(), args );
		}
		catch ( AbstractMethodError e ) {
			throw new HibernateException( "The JDBC driver does not implement the method: " + method, e );
		}
		catch ( InvocationTargetException e ) {
			throw e.getTargetException();
		}
	}

	/**
	 * Generates a SerializableBlob proxy wrapping the provided Blob object.
	 *
	 * @param blob The Blob to wrap.
	 *
	 * @return The generated proxy.
	 */
	public static Blob generateProxy(Blob blob) {
		return (Blob) Proxy.newProxyInstance( getProxyClassLoader(), PROXY_INTERFACES, new SerializableBlobProxy( blob ) );
	}

	/**

View on GitHub (pinned to fad1729dce)

Solutions

  1. Upgrade the JDBC driver to a JDBC 4+ build matching your database (ojdbc11, mysql-connector-j 8.x+, mssql-jdbc 12.x, postgresql 42.x)
  2. Remove conflicting old driver jars from the classpath so the new one actually loads
  3. Verify the driver's level with connection.getMetaData().getJDBCMajorVersion() (need >= 4)
  4. As a stopgap, unwrap the raw Blob via ((WrappedBlob) proxy).getWrappedBlob() and restrict yourself to methods the driver implements

Example fix

// before: old driver, JDBC 4 method
blob.free(); // HibernateException: The JDBC driver does not implement the method: free

// after: upgrade driver, then verify
int major = connection.getMetaData().getJDBCMajorVersion(); // >= 4
if (major >= 4) blob.free();
Defensive patterns

Strategy: validation

Validate before calling

static boolean driverSupportsJdbc4(java.sql.Connection c) throws SQLException {
    return c.getMetaData().getJDBCMajorVersion() >= 4;
}
// usage: if (driverSupportsJdbc4(conn)) blob.free(); else /* legacy driver: skip, close statement instead */

Try / catch

try {
    blob.free();
} catch (org.hibernate.HibernateException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("The JDBC driver does not implement")) {
        // driver predates this method: rely on statement/connection close to free resources
        stmt.close();
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling Blob.free() (JDBC 4.0) or getBinaryStream(long, long) (JDBC 4.1) on drivers such as ojdbc14, MySQL Connector/J 3.x/5.0, jTDS, or the JDBC-ODBC bridge; mixing an upgraded application (Hibernate 6 requires JDBC 4.x surfaces) with a stale driver jar still on the classpath.

Common situations: Upgrading Hibernate/app server while the old driver jar remains in WEB-INF/lib or the server lib directory; JDK upgrades (Java 8 -> 17) where the old driver no longer matches; transitive dependencies pulling in legacy drivers; internal drivers that never implemented later JDBC Blob methods.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/cbb8bf0f3b3dfbfd. Report an issue: GitHub.