Show TOC

 Adding Descriptions to persistent.xmlLocate this document in the navigation structure

In the deployment descriptor persistent.xml, you will enter the data source that points to the entity bean. You will also map the entity bean and the associated CMP fields to the table and its columns.

Prerequisites

The structure of your project QuickCarRentalEjb is currently displayed in the J2EE Explorer.

Procedure

Specifying the general properties

  1. Double-click the persistent.xml node of the QuickCarRentalEjb project structure.

    The Developer Studio opens a multipage editor, which allows you to enter persistent properties in the standard deployment descriptor persistent.xml.

  2. In the General tab, in the Datasource name field, enter the name CAR_RENTAL_POOL.
  3. Tick the Specify database vendor checkbox; in Database vendor, choose SAPDB.
  4. Leave the other default settings on this tab unchanged.

    These entries are automatically added to the XML source at the appropriate point.

     
    <persistent-ejb-map>
       <locking
           type="Table"/>
       <db-properties>
           <data-source-name>CAR_RENTAL_POOL</data-source-name>
           <database-vendor name="SAPDB"/>
       </db-properties>
     ...
     

Assigning a table to the entity bean

  1. Choose the Entity Beans tab.
  2. In the left pane, click the QuickBookingBean node.

    In the right pane, input fields appear where you can assign the table.

  3. Click the  button. 

    You can assign the table in the wizard that appears.

  4. Choose QuickCarRentalDictionary → QCR_RESERVATION and confirm your choice with OK.

Mapping CMP fields to table fields

  1. Expand the QuickBookingBean node.
  2. In this structure, click the nodecmp-field → bookingId.
  3. Choose ID as the Column name.

    The assignment is confirmed with an output line The column is verified by the data dictionary.

  4. Repeat the above procedure as appropriate for the other CMP fields.

    Map the fields and table columns as follows:

    CMP field

    Table column

    vehicleTypeId

    VEHICLETYPEID

    reservationDate

    RESERVATIONDATE

    dateFrom

    DATEFROM

    dateTo

    DATETO

    pickupLocation

    PICKUPLOCATION

    dropoffLocation

    DROPOFFLOCATION

    status

    STATUS

  5. Save your changes to the deployment descriptors by choosing the appropriate Save icon in the toolbar.
Result

You have entered all the bean-specific descriptions that your application needs in the J2EE deployment descriptor persistent.xml.

Next step:

Adding Descriptions to ejb-j2ee-engine.xml