Results 1 to 3 of 3

Thread: JpaItemWriter step scope entityManagerFactory error

  1. #1
    Join Date
    Aug 2009
    Posts
    15

    Default 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 at 05:54 PM.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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?

  3. #3
    Join Date
    Jul 2010
    Posts
    2

    Default 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>

Posting Permissions

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