• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you explain why "it is not a best thing to do"?
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic