Adding Descriptions to ejb-jar.xml

In addition to the predefined entries, you will now enter specific deployment information about the two beans QuickBookingBean and QuickOrderProcessorBean in the J2EE standard descriptor ejb-jar.xml.



General Descriptions

Display name

Returns a label for the Jar file to be created.


Returns a description for the deployment descriptor as a whole.

Deployment Information for the Entity Bean

Abstract schema name

Declares an identifier for the entity bean QuickBookingBean in the Jar file. This name can then be referenced as a place-holder for the bean in statements in the EJB query language.


Contains a SELECT statement for the query method findByStatus of the entity bean.


Contains a query description.

Deployment Information for the Entity Bean

EJB Reference Name

Returns a local reference for the session bean QuickOrderProcessorBean to the entity bean QuickBookingBean. The entry defines the mapping from a reference name <ReferenceName/BeanName> that can be selected to the bean name. In this way, the reference name for the entity bean can be used in the source code of the session bean. It remains unchanged there, even if the name of the bean itself changes. 


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


Specifying the general properties of the beans


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

The Developer Studio opens a multipage editor, which allows you to enter bean-specific descriptions in the standard deployment descriptor ejb-jar.xml.

       2.      On the General tab, enter in the Display Name field the name QuickCarRental, along with a short text in Description – such as Quick Start for Car Rental example.

These entries are automatically added to the XML source at the appropriate point. You can check this out by choosing the Source tab and then navigating to this point in the XML source.



   <description> Quick Start for Car Rental example. </description>

   <display-name> QuickCarRental </display-name>




Entering entries for the entity bean

       3.      Choose the Enterprise Beans tab.

       4.      In the tree structure that appears, expand the entity beans node and choose QuickBookingBean.

Input fields appear to the right of the tree structure.

       5.      Enter in the field Abstract schema name the name QuickBooking.

       6.      Expand the tree structure entity beans ® QuickBookingBean ® query.

       7.      In this structure, choose the node for the finder method findByStatus.

To the right, input fields appear, where you can enter the EJB QL statements.

       8.      In the EJB QL Statement field, enter the following SELECT statement: select object(b) from QuickBooking b where b.status like ?1

In the Description field, add the text Find method for getting all bookings that have the given status.

The following entries are added to the XML source:





   <abstract-schema-name> QuickBooking </abstract-schema-name>



      <description> Find method for getting all bookings that have the given status



        <method-name> findByStatus </method-name>


            <method-param> java.lang.String </method-param>



     <ejb-ql> select object(b) from QuickBooking b where b.status like ?1 </ejb-ql>




Entering entries for the session bean

       9.      In the tree structure, expand the node session beans ® QuickOrderProcessorBean.

   10.      In this structure, select the ejb-local-ref node and choose Add.

A selection dialog appears with all the EJB projects created in the workspace.

   11.      Choose the entity bean QuickBookingBean and confirm your choice with OK.

Input fields appear to the right of the tree. You can define a local reference QuickOrderProcessorBean  to QuickBookingBean there.

   12.      In EJB Reference Name, enter QuickCarRental/QuickBookingBean.

The following entries are added to the XML source:









      <ejb-ref-name> QuickCarRental/QuickBookingBean </ejb-ref-name>

      <ejb-ref-type> Entity </ejb-ref-type>


      <ejb-link> QuickBookingBean </ejb-link>




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


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

Next step:

Adding Descriptions to persistent.xml