-
1. Re: Seam Bug?
sebastiendeg.sebastien.degardin.gmail.com Feb 11, 2008 1:56 PM (in response to msystems)Hi Kenneth,
I think it does not behave like a Extended Persistence context,
However, booth method could run on the same transaction (SMT), causing the persistence context to be propagated.Is it right that the first one trigger the event the second one is observing ?
I'm still having a look to see ...
-
2. Re: Seam Bug?
msystems Feb 11, 2008 2:47 PM (in response to msystems)Hi Sebastien,
I think it does not behave like a Extended Persistence context, However, booth method could run on the same transaction (SMT), causing the persistence context to be propagated.Yes, both methods will run in the same transaction because of SMT.
But entities are not destroyed (detached) from the persistence context between method calls - a 'normal' (no SMT and not extended) persistence context will be destroyed and all managed entity object instances will become detached.
It looks like it really don't matter if you use a @PersistenceContext or @PersistenceContext(type = PersistenceContextType.EXTENDED) when SMT is enabled !
@PersistenceContext == @PersistenceContext(type = PersistenceContextType.EXTENDED) if SMT is enabled.I must say it's not a problem for me - I'm just curious :-)
Is it right that the first one trigger the event the second one is observing ?Yes.
-
3. Re: Seam Bug?
sebastiendeg.sebastien.degardin.gmail.com Feb 11, 2008 4:36 PM (in response to msystems)
But entities are not destroyed (detached) from the persistence context between method calls - a 'normal' (no SMT and not extended) persistence context will be destroyed and all managed entity object instances will become detached.A transaction scoped persistence context (default) is tied to the lifecycle of the transaction.
that means, it's closed when the transaction completes
It looks like it really don't matter if you use a
@PersistenceContext or @PersistenceContext(type equals PersistenceContextType.EXTENDED) when SMT is enabled !
@PersistenceContext equals @PersistenceContext(type equals PersistenceContextType.EXTENDED) if SMT is enabled.Yes it matters,
if your SFSB belongs to Conversation for example and in that case you can use the extended Persistence context during the whole conversation (many requests).
However, the transaction scoped persistence context will be closed at the end of the transaction (one request).
-
4. Re: Seam Bug?
msystems Feb 11, 2008 5:10 PM (in response to msystems)Hmmmm...... I’m confusing myself :-)
A SMT persistence context transaction is bound to a (web) request and a default persistence context transaction is bound to the method invocation - i.e. entities are unmanaged (detached) after the request (SMT) or method invocation (no SMT).
And of course any (SMT or no SMT) extended persistence context will survive a method invocation (no SMT) or request (SMT) - i.e. entities are still managed.
Thanks for clarifying things :-)