This content has been marked as final.
Show 2 replies
-
1. Re: transaction of application scoped bean
grubman Jul 16, 2012 4:06 AM (in response to grubman)just to clarify, my intention is that foo() will commit its cahnges to the db whitout commiting the changes that ware made so far by the calling session scoped bean. In addition i'll want that both beans will see the cahnges.
-
2. Re: transaction of application scoped bean
grubman Jul 18, 2012 9:25 AM (in response to grubman)I found the answer, it was quite simple actually...
you cannot use @
PersistenceContext
in an application scoped bean.The only possible implementation is as follows:
@Name("bean") @Scope(ScopeType.APPLICATION) @Synchronized public class MyBean { public void foo(EntityManager em) { // using em... } }
And in that case, its clear that that calling session scoped bean will send its own EM and by that the transaction in foo will be the sane as the transaction of the calling bean.