java - Container-Managed Transactions -
just clarification on understanding of how container-managed transactions(cmts) work in jpa -
cmts spare application effort of beginning , committing transactions explicitly right?
cmts can applied session , mesage-driven beans , not pojos?
my rationale above questions - i'd know how access entity java-se application java-ee. need 2 separate persistence unit?
i allow myself rewrite answer cause wasn't clear @ , worse, things wrongs.
fact (and i) mixing ejb , jpa terminology.
jpa talking entity beans. session bean (including cmt , bmt) part of ejb spec.
in jpa talk container-managed , application-managed entity manager linked jta or resource-local persitence unit.
here relevant part of jpa spec :
a container-managed entity manager must jta entity manager. jta entity managers specified use in java ee containers. application-managed entity manager may either jta entity manager or resource-local entity manager.
[...]
both jta entity managers , resource-local entity managers required supported in java ee web containers , ejb containers. within ejb environment, jta entity manager typically used. in general, in java se environments resource-local entity managers supported.
[...]
an entity manager transactions controlled through jta jta entity manager. jta entity manager participates in current jta transaction, begun , committed external entity manager , propagated underlying resource manager.`
[...]
when container-managed entity manager used, lifecycle of persistence context managed automatically, transparently application, , persistence context propagated jta transaction
so need define 2 persistence unit if want use jta (weather or not container-managed) entity manager in java ee application.
Comments
Post a Comment