Results 1 to 2 of 2

Thread: How to use HibernateItemWriter with Hibernate 4?

  1. #1
    Join Date
    Nov 2012
    Posts
    1

    Default How to use HibernateItemWriter with Hibernate 4?

    Hi all,

    When using hibernate 3, the following code works:

    Code:
    	
             <bean id="ivsHibernateWriter"
    		class="org.springframework.batch.item.database.HibernateItemWriter">
    		<property name="hibernateTemplate" ref="hibernateTemplate"/>
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	
    	<bean class="org.springframework.orm.hibernate3.HibernateTemplate" id="hibernateTemplate" >
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    After upgrading my test failes with this exception:

    Code:
    org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolder
    I thought of changing the hibernateTemplate bean to be inline with hibernate 4, like so:

    Code:
    	
             <bean class="org.springframework.orm.hibernate4.HibernateTemplate" id="hibernateTemplate" >
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    However, this class does not exist.

    How should we work with Hibernate4 and spring Batch?

  2. #2
    Join Date
    Jul 2012
    Posts
    2

    Default

    Looks like you don't, since this issue is still open: https://jira.springsource.org/browse/BATCH-1904

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •