This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBObject question.

 
Kenneth Lomvey
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the examples with explanations.
 
Rahul Ba
Ranch Hand
Posts: 206
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I agree with Jai.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic