-
1. Re: EntityManager from long running conversation injected in RequestScoped bean without propagation
blabno Feb 23, 2012 1:51 AM (in response to miguelzp)Display #{conversation.id} on the page to see if it's really different conversation. If it's different conversation then it can't be the same instance of EM. BTW. Remember that what you get injected is a proxy and not actual EM instance.
-
2. Re: EntityManager from long running conversation injected in RequestScoped bean without propagation
miguelzp Feb 23, 2012 2:35 AM (in response to blabno)Bernard,
thx for your answer. #{conversation.id} is null on page2.xhtml as Bean2 is RequestScoped and there is definitely no propagation. I get the same proxy with the same delegate (with the same entities and collections managed as after the last conversational request to Bean1).
My current workaround is to make Bean2 @ConversationScoped and to progagate the conversation with cid param.
Generally I prefer to use the less stateful scope...
-
3. Re: EntityManager from long running conversation injected in RequestScoped bean without propagation
hantsy Feb 25, 2012 11:12 PM (in response to miguelzp)From consversation scoped view to request scoped view, I use s:viewAction in the request scoped veiw to determine there is a Long conversation, if there is a long run conversation, end it directly.
<s:viewAction action=#{conversation.end} if=#{not conversation.transient}/>
-
4. Re: EntityManager from long running conversation injected in RequestScoped bean without propagation
miguelzp Feb 26, 2012 10:31 AM (in response to hantsy)Nice one, Hantsy! I'm sure I'll need to use it at some other point. However in the described case above I would still need the long running conversation for page1.xhtml as page2.xhtml opens in a new tab/window:
<h:outputLink value="page2.xhtml" target="_blank">
^^^^^^^
-
5. Re: EntityManager from long running conversation injected in RequestScoped bean without propagation
hantsy Feb 27, 2012 6:44 AM (in response to miguelzp)it is impossbile.
Add the viewAction in the page2.xhtml, and put the following code fragment in the template to check the current conversation. it worked as expected.here.
#{conversation.transient ? 'transient' : 'long-running, id: '.concat(conversation.id)}