-
1. Re: Ending conversation but objects still remain in conversation scope
wark2007 Jul 30, 2008 10:14 AM (in response to wark2007)Anyone can help?
-
2. Re: Ending conversation but objects still remain in conversation scope
obfuscator Jul 30, 2008 11:22 AM (in response to wark2007)There is always a conversation present, and it can be temporary or long-running.
If the conversation is long-running, which can be set by using @Begin, the context gets propagated to the next request of the same user (session). If not (temporary conversation), the context will be destroyed when the request ends. @End merely tells Seam to demote the conversation to temporary.
A conversation context will not be destroyed during a request, because the context has the same life-span as a request (in practice it is bound to the current thread as a ThreadLocal).
There is lots and lots of documentation on this. Read the docs.
-
3. Re: Ending conversation but objects still remain in conversation scope
obfuscator Jul 30, 2008 11:33 AM (in response to wark2007)Hmm, I managed to sneak errors into my text already. You can end the conversation before a redirect if you use @End(beforeRedirect=true)
-
4. Re: Ending conversation but objects still remain in conversation scope
digdas.seam.digdas.nl Jul 30, 2008 2:56 PM (in response to wark2007)Looks a bit like my problem.
I use the EntityHome on the new page - as created by JBoss Tools - New Entity.
When a user clicks on the menu for the list, then clicks on one of the rows to edit, then clicks on the menu to see the list again, and clicks on another row to edit, the first row is visible.
To avoid this problem, so the new row to edit is edited, I changed the RequestParameter in the home object:
@RequestParameter public void setMdaIcnMonthsId(Long mdaIcnMonthsId) { if (mdaIcnMonthsId != null) if (this.getConversation().isLongRunning()) if (this.instance != null) if (this.instance.getKey() != null) if (this.instance.getKey().compareTo(mdaIcnMonthsId) != 0 ) { this.instance = getEntityManager().find(MdaIcnMonths.class, mdaIcnMonthsId); } this.mdaIcnMonthsId = mdaIcnMonthsId; }
But this seems to me a bit wrong. Is it, or what should I do. Have not found an answer on forum or book...
-
5. Re: Ending conversation but objects still remain in conversation scope
obfuscator Jul 30, 2008 3:00 PM (in response to wark2007)read this
-
6. Re: Ending conversation but objects still remain in conversation scope
digdas.seam.digdas.nl Jul 30, 2008 3:28 PM (in response to wark2007)Thanks, I am reading this.
But I can not find the answer...
The example I use was created by Seam - Create new entity. A list object and a home object together with the xhtml-pages is created.
The standard behaviour is as I stated:
When a user clicks on the menu for the list, then clicks on one of the rows to edit, then clicks on the menu to see the list again, and clicks on another row to edit, the first row is visibleIn the example use is made of an action method to select the correct object.
I am looking for something to use this option and work with the correct object.The code I am using here does the trick, but I think it is nasty to do it like this.
-
7. Re: Ending conversation but objects still remain in conversation scope
wark2007 Aug 12, 2008 11:11 AM (in response to wark2007)I used a workaround to avoid these problem in my code. I thought that when I stop a conversation with @End or programatically with Conversation.instance().end(); that all objects stored in that conversation will be destroyed. Unfortunately, that is only true if I do no start a new conversation within the same request (no redirect). Or isn't it?
Currently I am using
@Begin(join=true)
so there is no need to end the current conversation and start a new one but all existing objects won't be destroyed. Is there a solution to destroy all objects in a conversation? -
8. Re: Ending conversation but objects still remain in conversation scope
coldgin Apr 21, 2009 9:06 PM (in response to wark2007)Yep, you are right. I had the same issue with my objects not being destroyed after the conversation ended. I specified <end-conversation before-redirect="true"/>, and then the objects were destroyed.
Thanks. -
9. Re: Ending conversation but objects still remain in conversation scope
brandonsimpson Apr 21, 2009 9:32 PM (in response to wark2007)From my understanding, ending the conversation just makes it a temp conversation again. It doesn't clean up any objects in the conversation. Normally these would only be cleaned up when the temp conversation then ends.
If you need to end a long conversation and start another fresh in the same method, you'd probably need to do some manual cleanup.
-
10. Re: Ending conversation but objects still remain in conversation scope
brandonsimpson Apr 21, 2009 9:36 PM (in response to wark2007)Sorry...forgot to say you could probably get the conversation context and do a clear() on it and not worry about ending/starting conversation.