Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes EJB and other Java EE Technologies and the fly likes Why EJB need interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why EJB need interface" Watch "Why EJB need interface" New topic

Why EJB need interface

karthik kummar

Joined: Jun 23, 2010
Posts: 11
Hi Friend,
I have one chilly doubt, why we are using interface(LOCAL and REMOTE) in EJB. could you please explain.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31549

To separate definition from implementation. And in the case of remote so as to not share the implementation.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
nirmal singh

Joined: Feb 07, 2008
Posts: 6
Hi karthik the reason behind is ejb are built for accessing remote enviroment which is completely different from the working as to establish the connection bw a stub and skeleton we use these interfaces as a common skeletal environment.thanks in advance :-))
malgo douginos

Joined: Jan 08, 2012
Posts: 2
I still don't understand, a program is already written,
so if it calls the third method of the interface it means it ALREADY knew that this method was in the interface, and it also already knew it's signature.
so why bother to retrieve the interface, why not just send "execute methoda(param b);" ?!
James Boswell

Joined: Nov 09, 2011
Posts: 1051

Sounds to me like you need to read up on the benefits of using interfaces. This is more than just an EJB issue.
I agree. Here's the link:
subject: Why EJB need interface