CMP 1.1 Database Settings

Enterprise Bean -> Entity tabbed pane -> Sun-specific Settings button -> Sun-specific Settings dialog box -> Database Settings button

The Database Settings dialog box allows you to specify the deployment settings for entity beans with version 1.1 of container-managed persistence.

Note: For versions of the J2EE SDK later than 1.2.1, you should use container-managed persistence version 2.0.

To enter deployment settings do the following:

  1. In the Database JNDI Name field, enter the JNDI name of the database that will store the state of the entity bean.
  2. If the DBMS requires a user name and password for a connection, enter them in the User Name and Password fields. (If you are using the Cloudscape DBMS shipped with this release, leave these fields empty.)
  3. If you want the database table to be created automatically during deployment, select the checkbox labelled "Create table on deploy." The table name will be the name of the entity bean class plus the word Table, enclosed in quotes. For example, for the AccountEJB class, the "AccountEJBTable" name is used. Note that the quotes are part of the table name.
  4. If you want the database table to be deleted automatically when the application is undeployed, select the checkbox labelled "Delete tableon undeploy."
  5. Make sure the DBMS server is running and click the Generate SQL Now button. The tool generates the SQL statements for the entity bean's methods.
  6. Enter the WHERE clause for every finder method except for the findByPrimaryKey method. To enter the WHERE clause, choose the method from the EJB Method list and append the clause to the SELECT statement displayed in the SQL Statement field. To indicate an input parameter in the WHERE clause, use ?1 for the first parameter, ?2 for the second, and so forth. For example, for the findByRange(double low, double high) method, the SELECT statement might be:
    SELECT "productid" FROM "ProductEJBTable"WHERE "price " BETWEEN ?1 AND ?2
  7. You may alter any of the generated SQL statements by choosing a method from the EJB Method list and entering text in the SQL Statement field. By default, quotes are placed around the names of tables, columns, and contraints. These quotes are part of the names.

Legal Notices