This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
(HFE) Home Business Methods -- Getting ref to EJB Obj
Krishnan Y N
Greenhorn
Joined: Aug 05, 2004
Posts: 10
posted
0
Hi ,
In HFE book, in page 325, it says the client can get a reference to the EJB object by using a "home business method that returns a ref to the bean's component interface".
In page 346, in the section "What to put in a home business method" the writing says "don't return the bean's component interface (the way finders and create must)"
This is contradicting...Would like to know which one is correct..
TIA
Giju George
Ranch Hand
Joined: Jun 08, 2004
Posts: 333
posted
0
Hi Krishnan, Even I picked up this !!!. As per the spec (10.6.6.), the method argument and return value types must be legal types for RMI-IIOP .
So I think it can return a ref to component interface.
SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA
Krishnan Y N
Greenhorn
Joined: Aug 05, 2004
Posts: 10
posted
0
Hi Giju,
Thx for the reply..Well i also did read the spec.. but then after reading the book.. was not so sure..
So should we say
"you can return a component interface from the business method but maybe that is not the best thing to do"
..
If we see a question that has a home business method returning a component interface, then i guess we should say it is valid piece of code ??
Cheerz krish
Joe Nguyen
Ranch Hand
Joined: Apr 20, 2001
Posts: 161
posted
0
Could you explain why "it is not a best thing to do"?
Philippe Maquet
Bartender
Joined: Jun 02, 2003
Posts: 1872
posted
0
Hi all,
There is no real contradiction IMO: I'd say that even if you *can* return a reference to the component interface (or a Collection of) from a home business method, you *should not* because it doesn't make sense.
As a matter of fact, a home business method returning a reference to the component interface (or a Collection of)... simply would be a finder with a weird name.
But it's not just a question of naming convention:
With CMPs, *finders* don't need anything in the bean implementation class: not even an abstract declaration.
In comparison, achieving *exactly* the same functionality through a home business method would require:
to *implement* the ejbHomeXXX() method calling an ejbSelectXXX() method
to *declare* the corresponding abstract ejbSelectXXX() method