• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Doubt on interfaces for EJB 3

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

The following is from EJB 3 in Action,



If you want, you can apply the @Local, @Remote, or @WebService annotation in the
bean class without having to implement the business interface as follows:



My question here is with the @Remote annotation specified in the code above as it says that BidManager.class which is a POJI is the Remote interface for this session bean. So does this imply that when I write my client class (which is going to be a remote client), can I do a DI like this below,



OR do I have to do this,



Please help guys!
[ September 03, 2008: Message edited by: Jothi Shankar Kumar Sankararaj ]
 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jothi,

In the following code:



The BidManagerBean business remote interface is BidManager. There are no other business interfaces. So the proper way to get a reference to your bean will be to define:


You cannot use


BidManagerRemote is NOT a business interface of BidManagerBean.
 
Sergio Tridente
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's another scenario:

You define the following:


Now you have the obvious choice of doing DI as follows:


And the not so obvious:


The beauty of EJBs ;-)
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergio Tridente:
Hi Jothi,

In the following code:



The BidManagerBean business remote interface is BidManager. There are no other business interfaces. So the proper way to get a reference to your bean will be to define:


You cannot use


BidManagerRemote is NOT a business interface of BidManagerBean.



I competely got what you are trying to convey. Thanks for the response! Another question here is, can I also say the same interface to be a Local interface?



Would this be right?
 
Sergio Tridente
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Accordingly to section 4.6.6 of the ejb core specification:


The same business interface cannot be both a local and a remote business interface of the bean.

 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sergio!
 
Our first order of business must be this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic