0 Replies Latest reply on Jul 6, 2016 5:12 AM by Gunnar Morling

    JBeret on Java SE - Transaction control and retrieval of entity manager

    Gunnar Morling Newbie

      Hi,

       

      Is there an example which shows the usage of JBeret on Java SE, working with a JPA entity manager? More specifically, I'm interested in two aspects:

       

      * How to obtain the entity manager? I suppose the right way is to bootstrap it manually, via Persistence#buildEntityManagerFactory(), using a persistence unit name given as a job parameter

      * How is transaction control supposed to look like under Java SE? Should I manually open/commit transactions in the item reader/writer when running on Java SE? Or is there any way to have JBeret control transactions on my behalf? Are there any patterns or best practices for this, maintaining portability of the batch job between Java SE and EE (where no manual TX control is needed, as it's done by the container)?

       

      Thanks for any input,

       

      --Gunnar