div.collapsecontent{display:block;}

Express (Distributed operating systems), v8.0 > Reference > Command-line utilities > EJB deployment tool


Implement query methods in home interfaces for CMP entity beans

EJB 2.x provides a query syntax called EJB QL for both finder and select methods of CMP entity beans.

Finder methods obtain one or more entity bean instances from a database, and are defined in the home interface. Select methods are defined on the abstract bean class and can return entity beans (any entity bean type defined in the EJB JAR file) or CMP field values.

The <query> element is used to define the query for the finder method in the deployment descriptor, for every finder method except findByPrimaryKey(key). Queries specified in the deployment descriptor are translated into SQL during deployment. The query statement is contained in the <ejb-ql> element of the <query> element:

<query>
<query-method>
<method-name>findAll
</method-name>
<method-params>

<method-param>
</method-param>
</method-params>

</query-method>
<result-type-mapping>
</result-type-mapping>
<ejb-ql>select object(o) from Employee o
</ejb-ql>
</query> 

Where to find additional information about the EJB query language

Detailed information about how to structure EJB queries is found in Chapter 11 of the EJB 2.x specification available at java.sun.com/products/ejb/docs.html. However, the WebSphere documentation contains the Sun information along with the WebSphere extensions.


Feedback

+

Search Tips   |   Advanced Search