Adding a Finder Method to a CMP Entity Bean

  1. 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.
  2. 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>.
  3. In the Navigator, right-click this view object.
  4. Choose Edit.
  5. Select the Query tab.
  6. 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