java - SessionFactory calling openSession throws noSuchMethoderror exception -


i using hibernate 3.2.5.ga, when invoking opensession of sessionfactory, returns session object of type org.hibernate.classic.session :

public org.hibernate.classic.session opensession() throws hibernateexception; 

i using spring batch 2.2.7.release, when setting sessionfacotry in hibernateitemreaderhelper, exception thrown when opensession in invoked because expects session of type : org.hibernate.session:

java.lang.nosuchmethoderror: org.hibernate.sessionfactory.opensession()lorg/hibernate/classic/session; 

anyone knows solution this?

p.s. can not upgrade hibernate.

it odd use org.hibernate.classic.session implementation in sessionfactory after version 3 version 4 seeing how both available ( org.hibernate.classic.session , org.hibernate.session) after version 3. may know spring classic used compatibility hibernate 2.1, deprecated of hibernate 3.

advice

you should not using hibernateitemreaderhelper spring internal class. it's introduced in spring batch 2.2.7.

solution

i've looked @ code of couple of available item readers used new org.hibernate.session. there no way getting around in version.

  • if cannot change hibernate version, change spring batch version earlier 1 , choose 1 of it's item readers.
  • if can't either, build custom item reader.

here'a link browse spring batch source code , check session version being used when if start looking item readers in various spring batch versions under package org.springframework.batch.item.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -