aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJBObject question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJBObject question." Watch "EJBObject question." New topic
Author

EJBObject question.

Kenneth Lomvey
Ranch Hand

Joined: Nov 08, 2008
Posts: 94
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

Joined: Jul 20, 2005
Posts: 10102
    
165

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.


[My Blog] [JavaRanch Journal]
Kenneth Lomvey
Ranch Hand

Joined: Nov 08, 2008
Posts: 94
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

Joined: Jul 20, 2005
Posts: 10102
    
165

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

Joined: Nov 08, 2008
Posts: 94
Thanks for the examples with explanations.
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
Yes, I agree with Jai.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJBObject question.