Adding a Finder Method to a CMP Entity Bean
- Add
the finder method to the Home interface of the EJB.
Note: The finder method must return type java.util.Enumeration.
The name of the method must begin with find. It can take any number
of parameters.
- ADD CMP persistence to your EJB.
In addition to the persistence object and standard view object, JDeveloper
will create a view object called <MyEntityEJB><method>.
- In the Navigator, right-click this view object.
- Choose Edit.
- Select the Query tab.
- Edit the WHERE clause of the query to match your finder method.
For example, suppose you created a method
Enumeration findByStatus(String status)
that you wanted to return all customers with a status matching the parameter.
The WHERE clause of the query should read
STATUS=:1