Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Ejb EJB Interfaces

Related Tutorials


 
 

Share on Google+Share on Google+

EJB Interfaces

Advertisement
Interface in java means a group of related methods with empty bodies. EJB have generally 4 interfaces.

EJB Interfaces

     

Interface in java means a group of related methods with empty bodies. EJB have generally 4 interfaces. These are as follows

1)Remote interface:- Remote interface are the interface that has the methods that relate to a particular bean instance. In the Remote interface we have all get methods as given below in the program. This is the interface where all of the business method go.javax.ejb.Remote package is used for creating Remote interface.

package ejb;

import javax.ejb.Remote;

@Remote
public interface Bean30Remote {

String getMessage();

String getAddress();

String getCompanyname();
}


2)Local Interface:-Local interface are the type of interface that are used for making local connections to EJB.@Local annotation is used for declaring interface as Local. javax.ejb.Local package is used for creating Local interface.

package ejb;

import javax.ejb.Local;

@Local
public interface NewSessionLocal {

}


3)Home Interface:-
Home interface is the interface that has methods that relate to all EJB of a certain class as a whole. The methods which are defined in this Interface are create() methods and find() methods . The create() method allows us to create beans. find() method is used in Entity beans.

import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import java.rmi.RemoteException;

public interface Bean30RemoteHome extends EJBHome{
public Bean30Remote create() throws CreateException, RemoteException;
}


4)Localhome Interface:-The local interfaces extend the following interfaces. These interfaces are generally for use by clients
 javax.ejb.EJBLocalObject - for the Object interface
 javax.ejb.EJBLocalHome - for the Home interface 

package ejb;

import javax.ejb.EJBLocalHome;
import javax.ejb.CreateException;

public interface NewSessionLocalHome extends EJBLocalHome {
public NewSessionLocal create() throws CreateException;
}
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 12, 2009

Related Tutorials

Discuss: EJB Interfaces  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
javed
December 18, 2012
adding

how to add two numbers in ejb... explain me.. with example.
DMCA.com