[wildfly-dev] discussion about JSR352 Batch and JPA

Jason Greene jason.greene at redhat.com
Wed Sep 18 13:43:51 EDT 2013


On Sep 18, 2013, at 7:54 AM, Scott Marlow <smarlow at redhat.com> wrote:

> What are the requirements for supporting Batch section 11.6 [1]?  From 
> looking at JSR352, I get that each "chunk" has its own JTA transaction. 
>  I previously had heard that we only supported starting the transaction 
> from the application processing code (via UserTransaction) but I think 
> the Batch container/runtime should start a JTA transaction for each 
> "chunk" that is processed.  What are we really doing for managing the 
> JTA transactions for batch?
> 
> 
> REGULAR CHUNK PROCESSING & JPA
> 
> 
> For the JPA support for regular chunk processing [1], the following will 
> give a new underlying persistence context per chunk (jta tx):
> 
> @PersistenceContext(unitName = "chunkNonpartitionedAZTT4443334")
>  EntityManager em;
> 

That won't work because the same block of code is executed in parallel from 2 different threads. Each chunk needs a clean entity manager.


--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat




More information about the wildfly-dev mailing list