The following technical details and design issues are random observations about the JPA API and Java in general. I try to verify through experimentation every fact that appears here - but use this list at your own risk.
DI1: An EntityManager instance is not thread safe @ThreadSafe by design - however a container managed entityManager that is transactional (with default EE PersistenceContextType.TRANSACTION and default EE scoped transaction-type="JTA") is thread safe because you deal directly with a proxy wrapper provided by the enterprise container ($ProxyNN). The container is able to manage simultaneous access to the referenced EntityManager as well as provide services via bytecode instrumentation/weaving like change tracking, security, resource management and transactions. Therefore I recommend a container managed entityManager where possible.
Running JPA based Enterprise Java EE applications on various Application Server containers
Friday, December 31, 2010
Subscribe to:
Post Comments (Atom)
3 comments:
Is the thread safety (For transaction scoped EntityManager) part of JPA official specification?
PRO JPA 2 book (by Mike Keith and Merrick Schincariol) Does state that They are stateless whereas EJB in Action ( Debu Panda et al) state that They are not thread safe ( at least in injecting in servlets).
Thanks for this tutorial. It helpful for me.
Máy đo đường huyết giá rẻ
Post a Comment