[seam-dev] [seam-persistence] ManagedPersistenceContextExtension
Mark Struberg
struberg at yahoo.de
Sun Jul 10 14:07:22 EDT 2011
Hi folks!
While reviewing an OWB bug report, 2 questions came up:
a.) EnvironmentUtils#isEEEnvironment() relies on the absence of 'javax.ejb.Stateless' to decide if a PersitenceUnit gets injected or if you need to do it yourself. I think this is an unrelieable assumption. E.g. there are a few Extensions which emulate Stateless Session beans via a CDI Extension by morphing them into @ApplicationScoped.
b.) in ManagedPersistenceContextExtension#registerManagedPersistenceContext you register the bean for the EntityManager as passivationCapable. This is never _never_ NEVER true. The EntityManager is not Serializable! There is imo no way to have an EntityManager in a bean scoped other than @RequestScoped or shorter (e.g. @TransactionalScoped). Any other trick is not working in a portable way. This is mainly caused by JPA still supporting pessimistic locking (_real_ locks in the database) as first class citizens.
But I'd be happy if anyone could enlighten me and tell us how it works ;)
LieGrue,
strub
More information about the seam-dev
mailing list