EJB Designer pane

This is a feature of JBuilder Enterprise.

The EJB Designer helps you create session beans, message-driven beans, and entity beans that comply with the Enterprise JavaBeans 2.0 specification.

To begin creating an enterprise bean, right-click the EJB Designer pane Create EJB|Session Bean, Create EJB|Entity Bean, or Create EJB|Message-Driven Bean. A bean representation appears in the EJB Designer along with an inspector. Choosing one of the Create EJB commands also generates the bean class and its interfaces, which appear in the project pane. Use the bean's inspector to set and change property values of the bean.

Add fields and methods to a bean by right-clicking the top of a bean representation in the EJB Designer and choose Add|Field, Add|Method, Add|ejbCreate, Add|Finder, or Add|Select. Each field and method of a bean also has an inspector. Click a field or method element in the bean to display its inspector. To complete a method, right-click it in the bean representation, choose View Bean Source, and write the appropriate logic.

As you work with the EJB Designer and its context menus and inspectors, the bean classes, interfaces, and deployment descriptors are being generated for you. You can modify your code directly in the code editor. The bean representation in the EJB Designer and your code remain synchronized.

EJB Designer toolbar

The EJB Designer has a toolbar that contains useful icons to make working with the EJB Designer quicker.

Icon   Description
Create EJB - Displays a menu for creating EJBs.
Import EJB - Displays Import EJB dialog box.
Delete Selected EJBs - Deletes all EJBs you have selected in the EJB Designer.
Create Schema From Selection - Creates a schema from EJBs you have selected in the EJB Designer.
Views - Displays the Views menu that has several commands for creating and deleting views and for moving EJBs between views.
Import Schema From Database - Displays the Database Schema Provider dialog box for importing a schema into the EJB Designer.
Add - Displays a menu for adding fields, methods, finders, ejbCreate methods, select methods, and relationships to an EJB.
View Bean Source - Jumps to the source code of the selected field or method in a bean representation.
Open DD Editor - Opens the Deployment Descriptor editor.

EJB Designer pane menus

Right-clicking the EJB Designer panel displays a menu with these commands:

Command Description
Create EJB|CMP 2.0 Entity Bean Creates an EJB 2.0 entity bean representation in the EJB Designer and generates the bean class and interfaces for an entity bean with container-managed persistence. The generated classes appear in the project pane.
Create EJB|BMP Entity Bean Creates a EJB 2.0 entity bean representation in the EJB Designer and generates the bean class and interfaces for an entity bean with bean-managed persistence. The generated classes appear in the project pane.
Create EJB|Session Bean Creates a session bean representation in the EJB Designer and generates the bean class and interfaces for session bean. The generated classes appear in the project pane.
Create EJB|Message-Driven Bean Creates a message-driven bean representation in the EJB Designer and generates the bean class for a message-driven bean. The generated class appear in the project pane.
Import EJB Displays the Import EJB dialog box. Use it to import an enterprise bean into an EJB module using the EJB Designer. You'll find this useful if you want to import a bean from one EJB module to another or if you've obtained a bean that has no accompanying deployment descriptors. The source code of the bean you are importing must be in the project's source path.
Delete Selected EJBs Delete all enterprise beans you have selected in the EJB Designer and removes their generated classes from the project. You can select multiple beans by Ctrl-clicking each one or by clicking and dragging a selection rectangle around the ones you want to select.
Create Schema From Selection Creates a schema from the EJBs you have selected in the EJB Designer. Each bean selected adds a table to the schema in the structure pane. If a table already exists with the same name as the bean, you can choose to overwrite it.
Views|New View Creates a new view in the EJB Designer for you to create EJBs on or for you to move and copy existing bean representations to.
Views|Delete View Deletes the current view. If bean representations appear on this view, they are moved to the Default view.
Views|Rename View Changes the name of the current view that appears on the view's tab.
Views|Move Selection Moves the currently selected bean representations to another view.
Views|Copy Selection Copies the currently selected bean representations to another view.
Views|Remove Selection Removes currently selected bean representations to the default view. Beans cannot be removed from the default view.
Views|Arrange EJBs Arranges the bean representations on the current view in a logical manner.

Right-clicking a bean representation in the EJB Designer displays the same menu with these additional commands:

Command Description
Add|Field Adds a new field to the bean and displays its field inspector.
Add|Method Adds a new method to the bean and displays its method inspector.
Add|ejbCreate Adds a new ejbCreate method to the bean and displays its method inspector.
Add|Finder Adds a new finder method to the bean and displays its finder inspector.
Add|Select Adds an ejbSelect method to the bean and displays its inspector.
Add|Relationship Adds a new field to the bean with a line protruding from it. Click another bean you want to create a relationship with and the line will join the two beans. Click the new field to display the the relationship inspector and use it to modify the relationship's attributes.
View Bean Source Displays the source code for the selected bean. You can edit directly in the source code.
Open DD Editor Displays the deployment description information for the selected bean in the Deployment Descriptor editor. You can modify this information using the Deployment Descriptor editor.
Regenerate Interfaces Regenerates the bean's interfaces based on the current state of the bean class.

Structure pane

When you are using the EJB Designer, the structure pane displays any data sources you have imported or created. To modify the schema of these data sources right-click an element in the structure pane to display a menu and choose an appropriate menu command. You can use the schemas that appear in the structure pane as the foundation of entity beans you create when you right-click a table in the schema and choose Create CMP 2.0 Entity Bean or Create BMP Entity Bean.

Right-clicking the top DataSources node in the structure pane displays a menu with these commands:

Command Description
Import Schema From Database Displays a Database Schema Provider dialog box that allows you to specify the data source you want to import into the structure pane of the EJB Designer.
Add DataSource Adds a new DataSource node. Right-click the new node to display a menu with commands to add tables or modify properties.

Right-clicking a data source node in the structure pane displays a menu with these commands:

Command Description
Export Schema To SQL DDL Displays a Save DDL dialog box that allows you to save the schema you have created to a SQL Data Definition Language file. You can then use this file to create a data source that uses the schema you modified or created.
Edit DataSource Properties Displays a dialog box you can use to edit the properties that establish a connection to a data source.
Add Table Creates a new table node in the data source.
Refresh From Database ...
Rename Renames the data source. Enter the new name in the structure pane.
Delete Deletes the data source from the schema.

Right-clicking a table node in the structure pane displays a menu with these commands:

Command Description
Create CMP 2.0 Entity Bean Creates an entity bean with container-managed persistence using the schema of the table for the bean. Choose this command when you are satisfied with your schema and are ready to use it to create an entity bean.
Create BMP Entity Bean Creates an entity bean with bean-managed persistence using the schema of the table for the bean. Choose this command when you are satisfied with your schema and are ready to use it to create an entity bean.
Add Column Adds a column to the table.
Edit Table CMP Properties... Displays a dialog box you can use to modify the settings of Borland-specific CMP properties for the table.
Rename Renames the table. Enter the new name in the structure pane.
Delete Deletes the table from the schema.

Right-clicking a column node in the structure pane displays a menu with these commands:

Command Description
Edit Column Properties... Displays a dialog box you can use to modify the properties of the column.
Edit Column CMP Properties Displays a dialog box you can use to modify Borland-specific CMP properties of the column.
Rename Renames the column. Enter the new name in the structure pane.
Delete Deletes the column from the schema.