"matt.drees" wrote :
| I think nested conversations need to be discussed more.
I have the same opinion.
"jacob.orshalick" wrote : Maybe an expert on the effects of nested conversations
on a Seam managed persistence context could shed some light on this?
I'm anything but an expert regarding the effects of nested conversations on a
Seam-managed persistence context. So far my understanding (could be wrong) is that a
Seam-managed persistence context corresponds to
an instance of the org.jboss.seam.persistence.ManagedPersistenceContext component. This
is a conversation-scoped component, hence it can be injected into other components using
the @In annotation. Unlike "normal" conversation-scoped components,
ManagedPersistenceContext is annotated with @BypassInterceptors and @Install(false)
however. To define a managed persistence context with the name
"entityManager", the typical idiom is that the framework user puts a component
definition in config-file components.xml
| // components.xml
|
| <persistence:managed-persistence-context
| name="entityManager"
|
persistence-unit-jndi-name="java:/contactlistEntityManagerFactory"/>
|
How does a Seam-managed persistence context get instantiated? It gets instantiated like
any ordinary Seam component. For example, the Seam CRUD framework classes EntityHome and
EntityQuery both extend
org.jboss.seam.framework.PersistenceController which creates a Seam-managed persistence
context effectively via a call of Component.getInstance(name);
Now what happens if a nested conversation is in progress and there is an injection such as
the following or another call of Component.getInstance("entityManager")?
| @In EntityManager entityManager; //a Seam-managed persistence context
|
I'd say the usual rules for injections apply, that means Seam tries a hierarchical
context search. A nested conversation has read-only access to the context of the
outer conversation. Therefore, if a Seam-managed persistence context was instantiated
already in the parent conversation, the hierarchical search finds it and the nested
conversation thus shares the same persistence context with the parent conversation.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085740#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...