permaculture playing cards*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes (HFE) Home Business Methods -- Getting ref to EJB Obj Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "(HFE) Home Business Methods -- Getting ref to EJB Obj " Watch "(HFE) Home Business Methods -- Getting ref to EJB Obj " New topic
Author

(HFE) Home Business Methods -- Getting ref to EJB Obj

Krishnan Y N
Greenhorn

Joined: Aug 05, 2004
Posts: 10
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
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
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
Could you explain why "it is not a best thing to do"?
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
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



  • Regards,

    Phil.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: (HFE) Home Business Methods -- Getting ref to EJB Obj
     
    Similar Threads
    Local versus remote interfaces
    EJBObject.remove()
    Stateless Session Bean and remove()
    home business methods?
    HFEJB Errata?