You can use the Add Finder Descriptor wizard to add finder
methods to CMP 1.x beans that are using container-managed persistence.
About this task
With the wizard, you can add a new finder method or add
one based on an existing finder method that the wizard finds. If the
wizard locates no finder methods, you must create a new one.
Procedure
- Switch to the Java™ EE
perspective.
- In the Enterprise Explorer view, select the desired EJB
JAR file.
- Expand your project name and double click the Deployment
Descriptor.
- Select the bean on the Bean page of the editor and scroll
to the Finders section.
- Click Add. The Add Finder
Descriptor wizard opens. If you want to use an existing
finder, simply select an existing finder and click Finish.
Otherwise, you must create a new finder.
- If no finders exist, select New.
- In the Name field, type a name for
the new finder. Method names must begin with find.
- Optional: Click Add to
add a method parameter to the finder.
- Select a Return type for the finder
method, then click Next.
- In the Finder type list, select
one of the following types:
- EjbqlFinderDescriptor - Select this
option if you are using an EJB query language string as the finder
statement.
- FullSelectFinderDescriptor - Select
this option if you are using an SQL SELECT string as the finder statement.
This is also referred to as a SELECT custom finder.
- WhereClauseFinderDescriptor - Select
this option if you are using an SQL WHERE clause as the finder statement.
This is also referred to as a WHERE custom finder.
- UserFinderDescriptor - Select this
option if you are not specifying a string in the finder descriptor.
Instead, the finder descriptor only lists the name of the method for
the custom finder. If you use this option, you must make sure that
the finder method is implemented correctly.
- If you choose EjbqlFinderDescriptor as
the finder type, you can choose a sample EJB QL query in the Select
a sample finder field. Your selection populates the Finder
statement field with sample code.
- Complete the query string in the Finder statement field.
- Click Finish.