Select language:

Procedure documentation 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.

 

Entry

Description

General Descriptions

Display name

Returns a label for the Jar file to be created.

Description

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.

EJB QL

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

Description

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. 

 

Prerequisites

This graphic is explained in the accompanying text

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

 

Procedure

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.

 

 

This graphic is explained in the accompanying text

 

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.

 

<ejb-jar>

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

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

  <enterprise-beans>

  ...

 

 

 

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.

 

This graphic is explained in the accompanying text

  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.

 

This graphic is explained in the accompanying text

 

The following entries are added to the XML source:

 

<entity>

 <ejb-name>QuickBookingBean</ejb-name>

  ...

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

  ...

 <query>

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

 </description>

  <query-method>

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

  <method-params>

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

  </method-params>

  </query-method>

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

 </query>

</entity>

 

 

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.

 

This graphic is explained in the accompanying text

 

  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.

 

This graphic is explained in the accompanying text

 

The following entries are added to the XML source:

 

<enterprise-beans>

  <session>

  <ejb-name>ABQuickOrderProcessorBean</ejb-name>

  ...

  <ejb-local-ref>

  <description>

  </description>

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

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

  ...

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

  </ejb-local-ref>

  </session>

 

 

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

Result

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

 

Was this page helpful to you?