-
1. Re: Warning: do not use Seam managed pesistent context for B
christian.bauer Oct 1, 2007 8:31 AM (in response to koenhandekyn)What does "doesn't work" mean?
I bet it would work just fine if you would call entityManager.joinTransaction() in your method before you use the EntityManager. Of course the @Injected EM will not join the transaction automatically because the transaction is started AFTER injection, when the method is called. -
2. Re: Warning: do not use Seam managed pesistent context for B
koenhandekyn Oct 1, 2007 8:42 AM (in response to koenhandekyn)christian
thanx for the clarification. i will try your proposal of explicitely calling joinTransaction, but i expect it to work :)
still it is kind of confusing to me as it is working perfectly for the @PersistenceContext inject entityManager. i conclude that this one is joining the transaction auto-magically ????
i'm wondering what the rationale is for not having the seam managed entityManager auto-magically join the user transaction ? ( and have a different behaviour than the EJB3 inject persitenceContext)
thanx for any clarification or rationale
koen -
3. Re: Warning: do not use Seam managed pesistent context for B
christian.bauer Oct 1, 2007 8:43 AM (in response to koenhandekyn)Read this again:
Of course the @Injected EM will not join the transaction automatically because the transaction is started AFTER injection, when the method is called.
-
4. Re: Warning: do not use Seam managed pesistent context for B
stephen.friedrich Oct 1, 2007 9:10 AM (in response to koenhandekyn)Occurence count of the string "joinTransaction" in Seam 1.2.1 reference: 0
2.0 improved on that: Method is shown in exactly one code example without any comment :-( -
5. Re: Warning: do not use Seam managed pesistent context for B
koenhandekyn Oct 1, 2007 10:13 AM (in response to koenhandekyn)The good news is that indeed, a joinTransaction() call does the job with @In injected entityManager.
Of course the @Injected EM will not join the transaction automatically because the transaction is started AFTER injection, when the method is called
i think i understand your remark: seam injection occurs just in front of each method invocation and the transasction is only started in the method!
however, @PersistenceContext injection occurs somewhere at bean creation and even earlier if i understand well.
so while I think I understand the seam behaviour now (joining makes sense), i'm still confused why i don't have to do a joinTransaction with @PersistenceContext injected entityManager (where does the join happen?) and why the behaviour should be different. -
6. Re: Warning: do not use Seam managed pesistent context for B
monkeyden Oct 1, 2007 11:55 AM (in response to koenhandekyn)I bet it would work just fine if you would call entityManager.joinTransaction()
Not that there was any doubt but Christian is exactly right.
See my topic from just a couple weeks ago:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=118996
RTF - Read the forum :)