Tutorials
EnterPrise Java Beans
Tutorial Index Page

Writing an EJB from scratch

We have been using an EJB wizard for doing our EJB development.

In the future as EJB technology matures, it is likely that more and more EJB wizards will become available.

However, at least once, it is a good idea to do everything "from scratch" without using a wizard.  By that it is not meant that you should memorize by rote the names of various methods such as ejbLoad and ejbStore etc and their function signatures!  By all means, lookup the wizard created files (or other sources) and use copy-and-paste to generate the basic framework if a wizard is not available.

The goal in this tutorial chapter is to understand that the wizards simply create a set of files following a certain set of rules.  You can create these files yourselves, and follow certain steps to create your EJBs.  Moreover, once you understand what the wizards are doing, it will be easier to modify the wizard-generated files for your purposes.

Exercise:  Start from the remote interface and home interface of the StockQuotes EJB and (in a separate directory) put together the framework for the full EJB.  Create the deployment descriptor, and the implemenation class, compile them and put them in a Jar file using the "jar" command, and run the blxejbc command to generate a full EJB.

Suggestion:  Don't try to put everything together all at once.  Leave things out and let the EJB compiler generate error messages telling you what it wants.
 

Next tutorial: Creating a Session EJB