• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJBObject question.

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Source: Maikalai Zaikin's Study Notes

I found the following statement on page number 60:


The getEJBObject method returns the session bean's remote interface. Only session beans with a remote EJBObject interface can call this method.




And I found the following statement on page number 73


The following are the requirements for the session bean's business interface: The interface MUST NOT extend the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface.



I confused with this. I think that the first statement says to extend the EJBObject interface, by the remote business interface, and the second statement says MUST NOT extend it!

Please can anyone explain this?

[ November 16, 2008: Message edited by: Kenneth Lomvey ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume these notes are for EJB3.0. I have seen many posts where the users are confused with similar statements in EJB3.

Starting EJB3, there is now a concept of "business interface", which is a Plain Old Java Interface. So a business interface MUST NOT extend the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface.

On the other hand EJB3 is backward compatible. What this means is, you can have EJB2.x style beans in your EJB3 application. The "Remote interface" is specifically meant for these EJB2.x beans. So a "Remote Interface" (implies this is for a EJB2.x bean) will be extending from the javax.ejb.EJBObject.
 
Kenneth Lomvey
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

I'm confused with this. You said the remote interface is for EJB 2.x and "business interface" is for EJB 3.0. Can you give me an example?

As I know, the below code is an example for a business interface in EJB 3.0:


We can use the @Remote and @Local annotations there to represent the interface as a local business interface or remote business interface.

So, I don't know what is the different between a business interface and a remote interface as you said above.

If both are same, where can I use EJBObject, and where I cannot do it?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's an example -

EJB2.x remote interface:


EJB2.x bean



ejb-jar.xml



EJB3.0 Business remote interface



EJB3.0 bean

 
Kenneth Lomvey
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the examples with explanations.
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I agree with Jai.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic