Announcement Announcement Module
Collapse
No announcement yet.
Statefull session not working with Hibernate 4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Statefull session not working with Hibernate 4

    For some reason when we try to use statefull session with spring batch we get some weird exception:
    Code:
    java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
    at org.springframework.batch.item.database.HibernateItemReaderHelper.createQuery(HibernateItemReaderHelper.java:152)
    at org.springframework.batch.item.database.HibernateItemReaderHelper.getForwardOnlyCursor(HibernateItemReaderHelper.java:122)
    at ....
    Using stateless session works fine. We use Spring batch 2.1.8.RELEASE, Spring 3.1.1.RELEASE and Hibernate 4.1.5.Final

    As far as I can see in the HibernateItemReaderHelper in Spring batch 2.1.8.RELEASE points to the new Hibernate 4 Session interface but it still looks for the classic Session. Anyboyd has an idea why?

    I already took a look at the classpath which looks like this:
    Code:
    activation-1.1.jar
    amqp-client-2.7.1.jar
    antlr-2.7.7.jar
    aopalliance-1.0.jar
    aspectjrt-1.5.0.jar
    aspectjweaver-1.5.2.jar
    aspectjweaver-1.6.9.jar
    avalon-framework-4.1.3.jar
    billing-commons-1.9.0-SNAPSHOT.jar
    billing-core-1.9.0-SNAPSHOT.jar
    cglib-nodep-2.2.2.jar
    classpath.txt
    commons-batch-2.0.0-SNAPSHOT.jar
    commons-beanutils-1.7.0.jar
    commons-cli-1.1.jar
    commons-codec-1.2.jar
    commons-customer-experience-1.3.0.jar
    commons-domain-1.0.0.jar
    commons-email-1.1.jar
    commons-email-1.9.1-SNAPSHOT.jar
    commons-hibernate-3.0.0-SNAPSHOT.jar
    commons-http-1.2.1.jar
    commons-httpclient-3.1.jar
    commons-httpclient-contrib-3.1.jar
    commons-io-1.3.1.jar
    commons-lang-2.1.jar
    commons-logging-1.1.jar
    commons-logging-1.2.0.jar
    commons-monitoring-1.0.0.jar
    commons-property-3.3.0.jar
    commons-rabbitmq-1.1.1.jar
    commons-spring-agent-2.5.0-SNAPSHOT.jar
    commons-util-1.6.1.jar
    customer-inventory-commons-1.4.0.jar
    customer-inventory-core-1.4.0.jar
    cxf-api-2.3.2.jar
    cxf-common-schemas-2.3.2.jar
    cxf-common-utilities-2.3.2.jar
    cxf-rt-bindings-xml-2.3.2.jar
    cxf-rt-core-2.3.2.jar
    cxf-rt-frontend-jaxrs-2.3.2.jar
    cxf-rt-transports-common-2.3.2.jar
    cxf-rt-transports-http-2.3.2.jar
    dom4j-1.6.1.jar
    generic-monitoring-console-api-1.1.0.jar
    geronimo-javamail_1.4_spec-1.7.1.jar
    hibernate-commons-annotations-4.0.1.Final.jar
    hibernate-core-4.1.4.Final.jar
    hibernate-entitymanager-4.1.4.Final.jar
    hibernate-jpa-2.0-api-1.0.1.Final.jar
    hibernate-validator-4.3.0.Final.jar
    javassist-3.15.0-GA.jar
    jaxb-impl-2.1.13.jar
    jboss-logging-3.1.0.GA.jar
    jboss-transaction-api_1.1_spec-1.0.0.Final.jar
    jettison-1.1.jar
    jms-1.1.jar
    jsr250-api-1.0.jar
    jsr311-api-1.1.1.jar
    log4j-1.2.15.jar
    logkit-1.0.1.jar
    mail-1.4.jar
    neethi-2.0.4.jar
    orchestration-api-1.7.0-20120820.120350-6.jar
    quartz-1.5.2.jar
    simplestuff-0.9.jar
    singleview-api-commons-1.1.0.jar
    singleview-api-core-1.1.0.jar
    slf4j-api-1.5.6.jar
    slf4j-simple-1.5.6.jar
    spring-aop-3.1.1.RELEASE.jar
    spring-asm-3.1.1.RELEASE.jar
    spring-aspects-3.1.1.RELEASE.jar
    spring-batch-core-2.1.8.RELEASE.jar
    spring-batch-infrastructure-2.1.8.RELEASE.jar
    spring-beans-3.1.1.RELEASE.jar
    spring-context-3.1.1.RELEASE.jar
    spring-context-support-3.1.1.RELEASE.jar
    spring-core-3.1.1.RELEASE.jar
    spring-expression-3.1.1.RELEASE.jar
    spring-jdbc-3.1.1.RELEASE.jar
    spring-orm-3.1.1.RELEASE.jar
    spring-tx-3.1.1.RELEASE.jar
    spring-web-3.1.1.RELEASE.jar
    spring-webmvc-3.1.1.RELEASE.jar
    stax2-api-3.0.2.jar
    validation-api-1.0.0.GA.jar
    woodstox-core-asl-4.0.8.jar
    wsdl4j-1.6.2.jar
    XmlSchema-1.4.7.jar
    xpp3_min-1.1.4c.jar
    xstream-1.3.1.jar

  • #2
    We got it working by checking out the Spring batch project and compile it against Hibernate 4. So it seams Spring Batch is not compatible with Hibernate 4. Are there any plans upgrading Spring Batch so it uses Hibernate 4?

    Comment


    • #3
      I'm also facing the same issue. This is the only issue holding our product from moving to Hibernate4.

      Since my team is not too keen on building a custom Spring Batch (as snkpetrus did), we'll wait a little more for a Spring Batch version compatible with Hibernate4. Anyway, it would be great to have at least a ballpark estimate on when (and if) this compatibility will be available.

      Comment

      Working...
      X