Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Krishnan Y N
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Krishnan Y N
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain why "it is not a best thing to do"?
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic