Announcement Announcement Module
Collapse
No announcement yet.
JpaItemWriter step scope entityManagerFactory error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JpaItemWriter step scope entityManagerFactory error

    When using JpaItemWriter with step scope , I am seeing this error

    This works if it is not step scoped. Its something to do with late binding but I don't any work around for this issue

    Caused by: java.lang.IllegalArgumentException: No EntityManagerFactory specified
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.orm.jpa.EntityManagerFactoryUt ils.doGetTransactionalEntityManager(EntityManagerF actoryUtils.java:165)
    at org.springframework.orm.jpa.EntityManagerFactoryUt ils.getTransactionalEntityManager(EntityManagerFac toryUtils.java:142)
    at org.springframework.orm.jpa.EntityManagerFactoryUt ils.getTransactionalEntityManager(EntityManagerFac toryUtils.java:124)
    at org.springframework.batch.item.database.JpaItemWri ter.write(JpaItemWriter.java:78)

    Has anyone encountered this issue?
    Last edited by shriny; Aug 16th, 2010, 05:54 PM.

  • #2
    It works for me. Are you sure you are not using the writer outside a transaction? What transaction manager do you use with the JobRepository?

    Comment


    • #3
      JPAItemWriter question

      Can you please post the sample code showing usage of JPAItemWriter ? My code looks like as follows. I am trying to read data from a flat file and write to db2 database table. I did search on this forum as well as on internet but didn't find sample code. I don't understand how JpaItemWriter will know which table to udpate. I can attach my source if needed.

      Thanks,
      Jagdish


      <bean id="statesWriter" class="org.springframework.batch.item.database.Jpa ItemWriter">
      <property name="entityManagerFactory" ref="entityManagerFactory" />
      </bean>

      Comment

      Working...
      X