An introductory textbook for EJB

Source: Internet
Author: User

1, the development of EJB

First, talk about the development steps of EJB.

Development of 1.1 Sessionbean

The first step is to write the remote interface (remoted interface), inherit the Ejbobject interface, write the public method that needs to be invoked (these methods will be implemented in Sessionbean), and note that you want to declare throws

Java.rmi.RemoteException.

For example:

package
jsper.ejb;
import java.rmi.*;
import javax.ejb.*;
public
interface MyEJB extends EJBObject
{
public String
sayHello() throws java.rmi.RemoteException;
}

Second step,

Write the Home interface (factory that generates ejbobject references) to generate at least one create method, note that you want to declare throws Java.rmi.RemoteException and Javax.ejb.CreateException.

Like what:

package
jsper.ejb;
import java.rmi.*;
import
javax.ejb.*;
public interface MyEJBHome extends
EJBHome
{
MyEJB create() throws
java.rmi.RemoteException, javax.ejb.CreateException;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.