简体   繁体   中英

Hibernate 4 calls setBinaryStream that is not supported in c3p0

Hibernate 4 uses jdbc4, were the signature of method setBinaryStream(int, InputStream, int) was changed to setBinaryStream(int, InputStream, long ). C3P0 does not support this new method.

So calling saveOrUpdate(myObjWithBlob) results

java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setBinaryStream(ILjava/io/InputStream;J)V
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at $Proxy75.setBinaryStream(Unknown Source)

So what can i do now?

1) Do not use c3p0. DHCP, BoneCP or no conntection pool at all. - is not really the option i want.

2) Somehow make hibernate avoid calling this new method? Is ist possible?

3) Switching back to hibernate 3 - is also not really good for me.

please upgrade to c3p0 0.9.2-pre8 (or wait a few days for 0.9.2 final). This issue has been resolved in recent releases of the library.

Update: c3p0-0.9.2 is now a release. it does resolve this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM