Reputation: 70584
There appear to be two patterns to implement business transactions that span several http requests with JPA:
What are the respective advantages of these patterns? When should which be preferred?
So far, I came up with:
However, not having any practical experience with JPA I am sure I have missed something of importance, hence this question.
In case it matters: We intend to use JPA 2.0 backed by Hibernate 3.6.
Edit: Our view technology is JSF 2.0, in an EJB 3.1 container, with CDI and possibly Seam 3.
Upvotes: 11
Views: 3208
Reputation: 47994
Well, I can enumerate challenges with trying to use extended persistence contexts in a web environment. Some things also depend on what your view technology is and if it's binding entities or view level middlemen.
(Problem 4 can of course also happen with session per request if the programming is sloppy, but you're not forced to actively work hard at avoiding it.)
Upvotes: 18