Skip Headers

# EJB Finders

Previous

Next

An EJB finder is a query as defined by the EJB specification. It returns EJB, collections, and enumerations. The difference between a finder and a query is that queries return Java objects, but finders return EJB. The TopLink query framework lets you create and execute complex finders that retrieve entity beans.

Finders contain finder methods that define search criteria. The work involved in creating these methods depends on whether you are building container-managed persistence (CMP) bean finders or bean-managed persistence (BMP) bean finders:

- CMP finders require the developer to define the finder API method signature on the bean `Home` interface. The CMP provider generates the actual code mechanisms for the finder from the API definition.

- BMP finders require the developer to provide the code required to execute the finder methods.

In either case, you define finders in the `Home` interface of the bean.

You can implement finders using any TopLink query feature and you can take advantage of predefined finder implementations that TopLink provides for both CMP and BMP entity beans.

This section describes the following:

- Predefined Finders

- Default Finders

- Call Finders

- DatabaseQuery Finders

- Named Query Finders

- Primary Key Finders

- Expression Finders

- EJB QL Finders

- SQL Finders

- Redirect Finders

- The ejbSelect Method

For more information, see "Using EJB Finders".