Use the EJB 1.x Entity Bean Modeler wizard to begin the creation of entity beans based on existing tables in any database accessible through JDBC. You can use the wizard to create several entity beans at once, and you can specify any relationships between those beans.
Once you've used the Entity Modeler to generate the code that make up the beans, their primary keys, their home and remote interfaces, and the appropriate entries in the deployment descriptor, you can then modify the results using other JBuilder tools, such as the Bean designer, the Deployment Descriptor editor, and the JBuilder code editor.
To display the EJB 1.x Entity Bean Modeler wizard, choose File|New to display the object gallery, click the Enterprise tab, then double-click the EJB 1.x Entity Bean Modeler icon.
Displays a list of EJB modules that are defined in your current project. Select the EJB module you want this new enterprise bean to belong to. If no EJB modules are listed or you want to create a new EJB module for the enterprise bean, click the New button to start the EJB Module wizard; once the EJB Module wizard finishes, the EJB 1.x Entity Bean Modeler resumes.
The second step establishes a connection to a JDBC data source.
Clicking the Choose Existing Connection button displays a Select Database dialog that displays existing database connections you might have already defined. If you select one of these existing connections and click OK, the remainder of the fields on the page are automatically filled in (except the Password field) with information about this existing connection.
If you check the All Schemas option, the EJB 1.x Entity Bean Modeler will load all schemas the user has rights to for the connection. If you leave All Schemas unchecked, just the schemas with the same name as the username, potentially reducing the time required to make the connection and load the data.
Check Views if you want the views associated with the connection loaded into the EJB 1.x Entity Bean Modeler.
Select the database driver you need to connect to your data source from the list of drivers. The list displays the drivers installed on your machine in black, while all other drivers are displayed in red.
Specify the URL to your data source. The pattern the URL must assume depends on the selected driver. The ... button next to the URL field is enabled in some cases to help you define the URL. What happens when you click the ... button depends on the driver you have chosen.
Specify a user name to access the data source.
Specify a valid password to access the data source.
Use the extended properties field to define additional connection properties your driver might be able to use. Clicking the ... button displays the Extended Properties dialog box to help you define extended properties.
Specify the name the JNDI should use to locate the desired data source.
Use this page to select the tables you want to map to entity beans.
Lists all the available tables in your specified data source. Move the tables you want to create entity beans for to the Selected box. To move all the tables to the Selected box, click the >> button. To move a single table at a time, click the table name in the Available box and click the > button.
Lists all the tables you've selected to create entity beans for. This box is empty until you make your selections.
Use this page to select the columns from each table to map to entity bean fields. You can also specify links between tables if you have more than one table.
Each table you selected on the previous page appears here. If you want to specify a relationship between tables, you can do so with the Link Tables dialog box. Display the Link Tables dialog box either by dragging your between the two tables, or by choosing the Add Link button.
Displays the Link Tables dialog box.
Displays the Link Tables dialog box to edit an existing relationship. Select one of the tables in the link in the Tables and Links box, then choose the Edit Link button.
Removes an existing link. Select one of the tables in the link in the Tables and Links box, then choose the Remove Link button.
Use these two boxes to determine which columns in the selected table are mapped to fields in the entity bean. To select a table, click one of the tables in the Tables and Links group. By default, all columns in the selected table are selected.
The Available box lists all the columns in the selected table that have not been selected to map to fields in the entity bean.
The Selected box lists all the columns in the selected table that have been selected to map to fields in the entity bean. By default, all columns are selected.
Use this page to map the columns of the table(s) to the fields in the entity bean(s). Each table has its own page. Click the page of each table in turn and specify your column-field mappings.
Displays all the selected columns in the table you selected in the Table field. First, specify which field or fields make up the primary key. You must specify a primary key for each table.
The wizard suggests a default Field Type and Field Name for each column. You can accept these types and names, or you can change these to meet your needs. You won't be able to change the Column Name or Column Type fields, as these are the fields as they exist in the data source.
If the table already has a primary key, that field or set of fields is selected when the table's page first appears. If no primary key exists, you must select one or more fields to make up primary key by checking the check box for those fields in the Primary Key column.
Finish mapping the columns for all the tables before you click Next.
Use this button to update the data type of multiple fields at once. A dialog box appears in which you can type the new field type. When you choose Apply or OK, the field type for each selected field changes.
Use this page to specify the names of the entity beans, home and remote interfaces, the primary key classes, and the package where they will be generated. You must complete this information for each table. JBuilder suggests values for these fields. You can accept them or change them as you wish.
The name of the entity bean.
The name JNDI uses to locate the bean.
The name of the entity bean's home interface.
The name of the entity bean's remote interface.
The name of the bean class.
The package where the primary key class is found.
The name of the primary key class. It can be any Java class or primitive data type.
Use this page to specify generation options
If selected, the bean will have container-managed persistence. This option does not appear if WebSphere 3.5 is your target application server.
If checked, the bean will have bean-managed persistence.
You can choose to generate your entity beans in the current EJB 1.1 style, or, if you want to prepare for EJB 2.0, you can choose to use the EJB 2.0 style.
Using this style, a single bean class is generated.
Using this style, the bean class is defined as an abstract class and all the getter and setter methods are also defined as abstract. A second bean class extends this first bean class. It's named either <Bean class>CMP or <Bean class>BMP, depending on whether it's a bean with container-managed or bean-managed persistence. You add your business methods to this second class.
By default, the EJB 1.x Entity Bean Modeler uses java.lang.Object
as the base class for all entity beans it generates. Use this field if you want to specify another class as the base.
When checked, this option does not generate schema in SQL. This option is enabled only if the Bean Managed Persistence option is checked.
If you don't have the option checked, SQL statements in generated BMP entity beans reference the table(s) using the schema. If the user is different than the schema; that is, if you are logged on as JOE, then the following would be generated:
SELECT <list of fields goes here> FROM SCOTT.EMP SELECT <list of fields goes here> FROM FOO // No schema because JOE.FOO is redundant
If the option is checked, the schema is not used. For example,
SELECT <list of fields goes here> FROM EMP // No schema because of checkbox SELECT <list of fields goes here> FROM FOO // No schema because JOE.FOO is redundant
Adds a findAll()
method to the home interface that returns all the rows in the data set.
Adds JavaDoc header comments to the top of the class and interface files.
This field is available if your target application server is a WebLogic application server. If you are creating an entity bean with container-managed persistence, enter the name of the pool for your WebLogic CMP beans.