Before you begin, you should have a general idea of what kind of EJB you plan to create. The EJBWizard supports the 4 major types of EJBs - although the "bean type" dropdown list shows the original 4 plus Message-Driven beans, MBD's aren't presently supported, since no templates or tabs have been designed for them (Contributions are welcome!). Here's how you use the EJBWizard tab-by-tab:
Enter the EJB's name. This is like a Java classname, except that this name must begin with an uppercase letter. The EJBWizard will enforce this rule automatically.
Enter the package name for the EJB. It's generally a good idea for each EJB to be in its own unique package.
Define the bean type.
You can define the fields in an EJB manually or by retrieving them from the definition of an existing database table. To do that, you must have defined the datasource(s) you wish to query in the $EJBWIZARD/datasources/datasource.properties file. Click the "datasource" button to bring up the datasource dialog, select a database from the dropdown list, and click "login" to retrieve information about that database. When you click "OK", the fields of the database table you have selected will be replicated into the Data tab's field table display, erasing any previous definitions.
For Entity EJB's, you must define one or more fields as key fields. To do this, select a non-zero value from the dropdown list in cells of the "key" column. The EJB's primary key class will be defined by taking these fields in the order of their "key" value.
Please note that the field definitions allow you to define a short description of the field's purpose. It's a good idea to fill this information in, as it will be repeated in various parts of the generated EJB and any JavaDocs you may generate from it.
Although EJB 1.1 allows you to define the primary key in terms of a simple class object, the EJBWizard always generates the primary key in a "wrapper" class. You can edit the generated code if this is a problem.
The Create tab is where you define the various create methods, analogous to Java class constructors - EJB's should not have constructors!
To define a create method, click on the "Add" button and fill in the dialog. The two most common create methods you will want to define are the no-arguments create method (just leave the argument list blank) and the all-fields create method. If you click on the "All fields" button, all of the fields defined on the Data tab will be added as arguments to the create method. You can also use this button as a shortcut - simply click "all fields", delete any fields that you don't want this method to use, and add any new fields. Use the "up" and "down" buttons to rearrange the order of arguments as needed. You can reduce the chances of mistyping a field definition this way.
Stateless session EJBs are not allowed to define create methods.
The return type of the finder method must either be the EJB type, a java.util.Enumeration or a java.util.Collection (or derivative)
You use the "SQL" button to bring up a dialog that defines how the EJB(s) are to be found
The SQL dialog is a generic text-entry field. Presently no validation is done. This is because in EJB 1.0 and 1.1 the finder code is appserver-dependent. For JOnAS EJBs, it's an SQL WHERE clause (including the introductory word "WHERE") or it's blank to find ALL EJB's. For WebLogic it's a WLCS expression such as "(< $0 100000)"
The EJBWizard will create standard display/edit JSPs and a JSP controller class. In many cases these JSP's can be used with little or no change. For them to work correctly, however, you must define an "all-fields" create method and an "findAllXXXX" method (where "XXXX" is the bean name).
Once you've filled in the various tabs of the EJBWizard, you can then save the definition (in a ".jjb" file) and/or generate the EJB source files.
The File/Generate menu command will pop up a dialog that allows you to choose the project directory into which you will generate the EJB's directory and subdirectories. The initial value for this can be set on the command line with the "-o pathname" option. Otherwise it will default to the working directory.