Marco Rietveld [
http://community.jboss.org/people/marco.rietveld] created the discussion
"Re: Persistence and Transaction Management"
To view the discussion, visit:
http://community.jboss.org/message/617007#617007
--------------------------------------------------------------
Hi Marco,
Thanks very much for posting all of this!
Could you maybe clarify +why+ you want to use application-managed persistence with jBPM?
You probably know this, but for clarification:
RESOURCE_LOCAL means that you want the entityManager (e.g. the persistence layer) to be
managed by the application. Application-managed persistence is most often used by
servlets, EJB's, and locally running java applications because these are in essence
small programs that don't need the extra overhead that container-managed persistence
brings with it.
These programs usually open a persistence context/connection, get the stuff they need,
commit the stuff they changed, and clean it all up: there is no usually no need for
fine-grained control transactions.
In my opinion, jBPM does need more fine grained control over transactions. It needs this
because +when+ objects/data (and which objects/data) are persisted is a more complicated
question. JTA gives you this control. Furthermore, I think there might be cases when you
want to commit some objects while leaving other objects in the persistence context
(logging objects vs. process context information).
In short, 1. jBPM needs to be sure that the persistence context is always available, which
would be more work for jBPM with application-managed/ (container-managed persistence just
works.. :-)) and 2. jBPM needs fine-grained control over transactions, which is easier
with JTA.
Does that make any sense? If I'm missing something, please point it out!
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/617007#617007]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]