This content has been marked as final.
Show 5 replies
-
1. Re: Injection and relation between components
hstang Jun 5, 2007 11:19 PM (in response to rmemoria)Is SourceConsumptionHome a regular javabean? If you haven't already, try adding a Scope=Conversation to the class.
EntityHome objects are, by default, conversation-scoped so they will participate through the entire lifecycle of a conversation, but regular javabean components are event-scoped. -
2. Re: Injection and relation between components
hstang Jun 5, 2007 11:22 PM (in response to rmemoria)As well, if you SourceConsumptionHome is in fact already conversation-scoped, you may want to try adding @Out to make sure the changes are outjected.
-
3. Re: Injection and relation between components
gavin.king Jun 6, 2007 12:35 AM (in response to rmemoria)"hstang" wrote:
As well, if you SourceConsumptionHome is in fact already conversation-scoped, you may want to try adding @Out to make sure the changes are outjected.
This is not necessary.
Just make sure that the sourceConsumptionHome component is conversation scoped. -
4. Re: Injection and relation between components
rmemoria Jun 6, 2007 6:29 PM (in response to rmemoria)Yes... It started working after I've included the component in conversation scope:
@Name("drugOrderHome") public class DrugOrderHome extends EntityHome<DrugOrder>{ private static final long serialVersionUID = 2666375478687085792L; @In(create=true) private SourceConsumptionHome sourceConsumptionHome;
@Name("sourceConsumptionHome") @Scope(ScopeType.CONVERSATION) public class SourceConsumptionHome {
OK... it's working nicely and perfectly. But to finish this topic, 2 more questions to the gurus:
1 - Why the first component doesn't require a @Scope(ScopeType.CONVERSATION) declaration like the second ? (the first component remains in memory up to the end of the conversation);
2 - I tryed before @In(create=true, scope=ScopeType.CONVERSATION) to inject the second component, but it wasn't created in a conversation scope. What does this declaration mean?
Thanks,
Ricardo -
5. Re: Injection and relation between components
hstang Jun 6, 2007 6:36 PM (in response to rmemoria)Hello,
"rmemoria" wrote:
1 - Why the first component doesn't require a @Scope(ScopeType.CONVERSATION) declaration like the second ? (the first component remains in memory up to the end of the conversation);
You extended EntityHome, which I assume is part of the framework package in Seam, which is setup as conversation-scoped by default."rmemoria" wrote:
2 - I tryed before @In(create=true, scope=ScopeType.CONVERSATION) to inject the second component, but it wasn't created in a conversation scope. What does this declaration mean?
I'm guessing it means to inject a context variable from the conversation scope. If it's not found, create it.