Creating the Enterprise Bean

The enterprise bean in our example is a stateless session bean called ConverterBean. The source code for ConverterBean is in the <INSTALL>/j2eetutorial14/examples/ejb/converter/src/ directory.

Creating ConverterBean requires these steps:

1.
Coding the bean's interfaces and class (the source code is provided)
2.
Compiling the source code with asant
3.
With deploytool, packaging the bean into an EJB JAR file and inserting the EJB JAR file into the application's ConverterApp.ear file

Coding the Enterprise Bean

The enterprise bean in this example needs the following code:

  • Remote interface

  • Home interface

  • Enterprise bean class

Coding the Remote Interface

A remote interface defines the business methods that a client can call. ...

Get The J2EE™ Tutorial Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.