This content has been marked as final.
Show 4 replies
-
1. Re: OneToMany relationships
alesj Jan 28, 2008 4:38 PM (in response to clebert.suconic)This is best explained with MainDeployer and Deployers example:
Instead of having each Deployer to call<install bean="MainDeployer" method="addDeployer"> <parameter>this</parameter> </install> <install bean="MainDeployer" method="removeDeployer"> <parameter>this</parameter> </install>
You can just add this:<bean name="MainDeployer" ...> <incallback method="addDeployer"/> <uncallback method="removeDeployer"/> </bean>
The callback idea is to check the type of method's parameter - in this case Deployer interface - and when a matching bean (by type --> instance of) is installed/uninstalled, you execute this callback.
So when a new Deployer bean is installed, it is automa(t|g)ically added to MainDeployer.
Exchange MainDeployer with Employee and Deployer with Address, and there you go. ;-)
All MC IoC xml elements have matching annotation support. In this case @Install/@Uninstall. -
2. Re: OneToMany relationships
clebert.suconic Jan 28, 2008 5:01 PM (in response to clebert.suconic)Sweet.. it worked without any problems!
something that useful should be on the main doc :-) This is much better than the Lifecycle callback example on the AOP chapter.
Thanks again -
3. Re: OneToMany relationships
alesj Jan 28, 2008 5:12 PM (in response to clebert.suconic)"clebert.suconic@jboss.com" wrote:
Sweet.. it worked without any problems!
;-)"clebert.suconic@jboss.com" wrote:
something that useful should be on the main doc :-) This is much better than the Lifecycle callback example on the AOP chapter.
It's all already there:
- http://labs.jboss.com/files/jbossmc/docs/2.0.x/userGuide/ch13s02.html -
4. Re: OneToMany relationships
clebert.suconic Jan 28, 2008 5:33 PM (in response to clebert.suconic)
It's all already there:
- http://labs.jboss.com/files/jbossmc/docs/2.0.x/userGuide/ch13s02.html
Duh! :-) Thanks a lot... I was so blink by looking at inject properties.