-
1. Re: @Factory and @DataModel on the same method
pmuir Mar 15, 2007 8:33 PM (in response to fabricio.lemos)This is bad idea. How is Seam to know whether you want a DataModel or a List when you access the useCaseList context variable?
-
2. Re: @Factory and @DataModel on the same method
tony.herstell1 Mar 15, 2007 8:44 PM (in response to fabricio.lemos)> javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: a5k2v46-y6may6-ezbt3tyr-1-ezbun2fe-10
I get lots of these.. never seems to break anything and it's only when beans are timing out.
If you find out how to get rid of these then please tell me.
:/ -
3. Re: @Factory and @DataModel on the same method
tony.herstell1 Mar 15, 2007 8:56 PM (in response to fabricio.lemos)Is this allowed then?
@DataModel
private Organisation[] organisations;
/*
* Methods
*/
@Factory("organisations") // Is run whenever this bean is created (we know its going to be the "All" query.
public void initOrganisations() {
log.info("> initOrganisations");
applyAllQuery();
log.info("< initOrganisations");
}
?? -
4. Re: @Factory and @DataModel on the same method
pmuir Mar 15, 2007 9:12 PM (in response to fabricio.lemos)Yes, thats correct :)
-
5. Re: @Factory and @DataModel on the same method
fabricio.lemos Mar 16, 2007 8:52 AM (in response to fabricio.lemos)"petemuir" wrote:
This is bad idea. How is Seam to know whether you want a DataModel or a List when you access the useCaseList context variable?
It really makes sense. Thank you. -
6. Re: @Factory and @DataModel on the same method
fabricio.lemos Mar 16, 2007 2:38 PM (in response to fabricio.lemos)"fabricio.lemos" wrote:
"petemuir" wrote:
This is bad idea. How is Seam to know whether you want a DataModel or a List when you access the useCaseList context variable?
It really makes sense. Thank you.
I was looking on others datamodels that I have and got I little more confusing. I found this method:@DataModel public List<Step> getStepList(){ return useCase.getSteps(); }
And the dataTable that reads the DataModel:<h:dataTable value="#{stepList}" var="stepVar"> <h:column> <f:facet name="header">Name</f:facet> #{stepVar.name} </h:column> <h:column> <f:facet name="header">Edit</f:facet> <h:commandLink value="Edit" action="updateStep" /> </h:column> </h:dataTable>
I do not know how Seam knows if it is a DataModel or a List when stepList is accessed, but it works pretty fine, also injecting the selected entity through a @DataModelSelection annotation. -
7. Re: @Factory and @DataModel on the same method
pmuir Mar 16, 2007 3:04 PM (in response to fabricio.lemos)There's no @Factory on that method. So, each time the stepList context variable is used, the getStepList method will be run (and the result fed through @DataModel)