This content has been marked as final.
Show 4 replies
-
1. Re: Components composition
gavin.king Nov 3, 2005 8:33 AM (in response to marius.oancea)Just keep a ref to A1 inside A and call its method.
I mean, there is no magic you need to know here, it just works like ordinary Java!
Or, alternatively, have A1 injected into A using @In. Whatever you like. It Just Works. -
2. Re: Components composition
marius.oancea Nov 3, 2005 8:52 AM (in response to marius.oancea)I understand what you mean but if I just keep a ref to A1 (and A1 is created with new) then the things into A1 will not be injected.
"A" has a method :xxx() { a1 = new A1(); } yyy() { a1.theMethod(); }
A1 has a method doPersistenceStuffdoPersistenceStuff() { // use em <--- is null because of course nobody injected it }
How to make the statefull session bean A to get the reference to the statefull SB A1 that is correctly injected and so on? -
3. Re: Components composition
gavin.king Nov 3, 2005 9:17 AM (in response to marius.oancea)Right, you should instantiate it using Component.getInstance(A1.class, true).
Or inject it. -
4. Re: Components composition
marius.oancea Nov 3, 2005 9:37 AM (in response to marius.oancea)Ok. Thanx a lot