-
1. Re: renew the @Factory
bsmithjj Sep 5, 2007 12:48 PM (in response to srpantano)Let's say your Seam component that contains this @Factory is session scoped; then you need to remove the current license from the session context. Example:
public String persistAndContinue(){ super.persist(); Contexts.getSessionContext().remove("license"); setInstance(new License()); }
Hope that helps. -
2. Re: renew the @Factory
srpantano Sep 5, 2007 1:36 PM (in response to srpantano)It didn´t works!
When submit the value in fields are in screen and when I press the submit button again give error. -
3. Re: renew the @Factory
srpantano Sep 5, 2007 1:40 PM (in response to srpantano)the interesting is: after submit the conversation are changed but the fields still there.
-
4. Re: renew the @Factory
bsmithjj Sep 5, 2007 1:54 PM (in response to srpantano)It didn´t works!
Well, you should probably post your entire component then and the markup that you claim is 'submit the action'. -
5. Re: renew the @Factory
srpantano Sep 5, 2007 2:08 PM (in response to srpantano)ok, here go!
in my add.xhtml page I put:#{messages['Name']}: <h:inputText id="name" size="30" value="#{license.name}"> <s:validate /> <a4j:support event="onblur" reRender="outMessageLicensee" /> </h:inputText> <s:link action="#{licenseHome.persistAndContinue}"> <h:outputText value="#{messages['Tosavecont']}"/> </s:link>
the add.page.xml:<page no-conversation-view-id="list.xhtml"> <begin-conversation join="true"/> <navigation from-action="#{licenseHome.persistAndContinue}"> <end-conversation/> <redirect view-id="add.xhtml"/> </navigation> </page>
and the class:@Name(value = "licenseHome") public class LicenseHome extends EntityHome<License> { @Override protected License createInstance() { license = new License(); return license; } @Override @Factory(value = "license") public License work() { return getInstance(); } public String persistAndContinue() { super.persist(); Contexts.getSessionContext().remove("license") ; setInstance(new License()); return ""; } public void setLicenseId(Long id) { setId(id); } public Long getLicenseId() { return (Long) getId(); } }
-
6. Re: renew the @Factory
fernando_jmt Sep 5, 2007 2:26 PM (in response to srpantano)See all my comments here, this maybe can help you.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117469 -
7. Re: renew the @Factory
bsmithjj Sep 5, 2007 2:32 PM (in response to srpantano)Hmmm....
EntityHome isn't well documented in Seam 1.2.1 (which is what I currently use) and so without reviewing the EntityHome impl code in Seam, I'll have to guess a bit here.
On closer inspection of your code, it looks like whether createInstance() is invoked or persistAndContinue() is invoked, both impl's as shown will produce a newly instantiated license.
However, you're saying that the 'data of previous object' is in "license" - are you submitting to a session- or conversational-scoped component? If you are, are you also outjecting license back to session or conversation?