Sun Java System Application Server Platform Edition 8.2 Upgrade and Migration Guide

Custom Finder Methods

The custom finder methods are the findBy... methods (other than the default findByPrimaryKey method), which can be defined in the home interface of an entity bean. Since the EJB 1.1 specification does not stipulate a standard for defining the logic of these finder methods, EJB server vendors are free to choose their implementations. As a result, the procedures used to define the methods vary considerably between the different implementations chosen by vendors.

Application Server 6.x uses standard SQL to specify the finder logic.

Information concerning the definition of this finder method is stored in the enterprise bean’s persistence descriptor (Account-ias-cmp.xml) as follows:


Each findXXX finder method therefore has two corresponding entries in the deployment descriptor (SQL code for the query, and the associated parameters).

InApplication Server 8.2 the custom finder method logic is also declarative, but is based on the EJB query language EJB QL.

The EJB-QL language cannot be used on its own. It has to be specified inside the file ejb-jar.xml, in the <ejb-ql> tag. This tag is inside the <query> tag, which defines a query (finder or select method) inside an EJB. The EJB container can transform each query into the implementation of the finder or select method. Here is an example of an <ejb-ql> tag:

          <![CDATA[SELECT OBJECT(t) FROM TMBankSchemaName AS t 
                                         WHERE = ?1]]>
  </enterprise-beans> ...