JCodeBox allows you to create all of the available Enterprise Java Bean (EJB) types:
Entity beans (BMP and CMP)
Session beans (stateful and stateless)
Message driven beans (MDB)
To define an EJB you need to complete the define <<EJB type>> dialog i.e. define Session EJB (v2.0).
If you are defining entity beans you can define more than one at a time (depending on available entities) and bypass
the define <<EJB type>> dialog - default values will be provided based on the underlying entity name (see
the Adding an EJB section for further details).
From the define <<EJB type>> dialog you can add many features to your EJB such as patterns, finders (entity only)
and environment entries. You can also add code elements such as business methods, imports and variables. Once defined, you
can preview your EJB to see the exact code that will be created.
The define <<EJB type>> EJB/Bean dialog is displayed.
Settings tab
Press the Select button. The select modelsource dialog is displayed.
Select a modelsource from the list
Press OK. The EJB dialog will be populated with values based on the selected modelsource name.
Modify the EJB package name text field if required
Modify the EJB bean name text field if required
Modify the EJB bean JNDI name text field if required (entity and session beans only)
Modify the EJB bean description name text field if required
Modify the EJB home interface text field if required (entity and session beans only)
Modify the EJB remote interface text field if required (entity and session beans only)
Modify the EJB local home text field if required (entity and session beans only) (J2EE 1.3 only)
Modify the EJB local text field if required (entity and session beans only) (J2EE 1.3 only)
Modify the EJB bean class text field if required
Modify the EJB primary key class text field if required (entity beans only)
Modify the EJB data source JNDI text field if required. This is linked to a resource reference on the resources tab. (entity beans only)
Enter some documentation for this EJB if required
Modify the EJB destination JNDI name text field if required (message beans only)
Select the transaction type for your EJB (message beans only)
Select the destination type for your EJB (message beans only)
Select the subscription durability for your EJB (message beans only)
Fields tab (entity beans only)
Change the field type for bean fields (if required) by double clicking on the correct cell in the correct fields table (primary
key or data) and typing the new value. The value entered must be a valid Java data type.
Change the field name for bean fields (if required) by double clicking on the correct cell in the correct fields table (primary
key or data) and typing the new value. The value entered must be a valid Java identifier.
Patterns tab (entity and session beans only)
Use the patterns buttons to add/edit/remove patterns for your EJB.
Use the home methods buttons to add/edit/remove home methods for your EJB (described in more detail later in the chapter).
(J2EE 1.3 only)
Find/Create tab (entity beans only)
Use the finders buttons to add/edit/remove finders for your EJB (described in more detail later in the chapter).
Use the select methods buttons to add/edit/remove select methods for your EJB (described in more detail later in the chapter).
(J2EE 1.3 CMP only)
Use the create methods buttons to add/edit/remove create methods for your EJB (described in more detail later in the chapter).
Code tab
Use the imports buttons to add/edit/remove imports for your EJB. The application button allows you to add imports
for other components in your application.
Use the class variables buttons to add/edit/remove variables for your EJB.
Use the methods buttons to add/edit/remove methods for your EJB.
Resources tab
Use the environment entries buttons to add/edit/remove environment entries for your EJB. (described in more detail later in the chapter)
Use the bean references buttons to add/edit/remove bean references for your EJB (described in more detail later in the chapter).
Use the resource references buttons to add/edit/remove resource references for your EJB (described in more detail later in the chapter).
Use the resource environment references buttons to add/edit/remove resource environment references for your EJB (described in more detail later in the chapter).
Types tab
Use the Types tab to add/edit/remove inherited/implemented types for the different parts of your EJB. (described in more detail later in the chapter)
Press OK to save your EJB
Your EJB is now displayed in the Business Tier of the define application dialog.
Adding multiple EJBs (entity beans only)
Right mouse click on Business Tier in the define application dialog
Select Add multiple BMP/CMP EJBs from the popup menu
Or
Select the Action=>Tier menu option from the main menu in the define application dialog
Select Business Tier and press next
Select Add multiple BMP/CMP EJBs and press finish
The select modelsource dialog is displayed.
Select the required modelsources from the list (use the shift key to select multiple modelsources).
Press OK. Your EJBs will be automatically defined and displayed in the Business Tier of the define application dialog.
Press the Add (finder) button in the define EJB dialog
The define finder dialog is displayed
Enter a finder name in the finder name text field
Select the finder return type
Select the target interface (BMP J2EE 1.3 only)
Press the Add field button. The select field dialog is displayed
Select a field and press OK
Repeat the previous 2 steps for each field you would like to add to your finder
To edit the criteria of a field, select the field and press the Edit field (criteria) button (or double click on the field). The
set field criteria dialog is displayed
Complete the set field criteria dialog and press OK and press OK
Select a field and press OK
To remove a field, select the field and press the Remove field button
Press OK to close the define finder dialog
Your finder will be displayed in the finders list.
Editing a finder (J2EE 1.2 and BMP J2EE 1.3)
Select the finder you would like to edit.
Press the Edit (finders) button
The define finder dialog is displayed
Modify the finder name in the finder name text field if required
Select the finder return type
Select the target interface (BMP J2EE 1.3 only)
Modify the finder fields using the Add field, Edit field (criteria) and Remove field buttons
Press OK to close the define finder dialog
Your updated finder will be displayed in the finders list.
Deleting a finder (J2EE 1.2 and BMP J2EE 1.3)
Select the finder you would like to delete.
Press the Delete (finders) button
Your finder will be removed from the finders list.
Adding a finder (CMP J2EE 1.3)
Press the Add (finder) button in the define EJB dialog
The define finder dialog is displayed
Enter a finder name in the finder name text field
Press the Add (parameter) button. The define parameter dialog is displayed
Enter a parameter type and parameter name and press OK
Repeat the previous 2 steps for each parameter you would like to add to your finder
Select the finder return type
Select the target interface
Enter the EJB-QL for your finder
Press OK to close the define finder dialog
Your finder will be displayed in the finders list.
Editing a finder (CMP J2EE 1.3)
Select the finder you would like to edit.
Press the Edit (finders) button
The define finder dialog is displayed
Modify the finder name in the finder name text field if required
Modify the finder parameters using the Add and Remove (parameters) buttons
Select the finder return type
Select the target interface
Modify the EJB-QL for your finder as required
Press OK to close the define finder dialog
Your updated finder will be displayed in the finders list.
Deleting a finder (CMP J2EE 1.3)
Select the finder you would like to delete.
Press the Delete (finders) button
Your finder will be removed from the finders list.
The types tab allows you to maintain inherited/implemented types for the different parts of your EJB (i.e. primary key class, home interface, bean class, etc). The following types can be maintained:
Bean class parent class
Enter the parent class in the parent class field in the bean class section
Bean class interfaces
Use the add/edit/remove buttons in the bean class section to maintain interfaces your bean class should implement
The Add and Edit buttons display the Add/Edit bean class interface dialog
Primary key class parent class (entity beans only)
Enter the parent class in the parent class field in the primary key class section
Primary key class interfaces
Use the add/edit/remove buttons in the primary key class section to maintain interfaces your primary key class should implement
The Add and Edit buttons display the Add/Edit primary key class interface dialog
Home interface implemented interfaces
Use the add/edit/remove buttons in the home interface section to maintain interfaces your home interface should extend
The Add and Edit buttons display the Add/Edit home interface interface dialog
Remote interface implemented interfaces
Use the add/edit/remove buttons in the remote interface section to maintain interfaces your remote interface should extend
The Add and Edit buttons display the Add/Edit remote interface interface dialog
Local home interface implemented interfaces (J2EE 1.3 only)
Use the add/edit/remove buttons in the local home interface section to maintain interfaces your local home interface should extend
The Add and Edit buttons display the Add/Edit local home interface interface dialog
Local interface implemented interfaces (J2EE 1.3 only)
Use the add/edit/remove buttons in the local interface section to maintain interfaces your local interface should extend
The Add and Edit buttons display the Add/Edit local interface interface dialog