3 Replies Latest reply on Mar 12, 2003 7:21 AM by canobi

    finder method

    qmqasim

      Hi,

      I tried to create a finder method using Xdoclet. I want to get all the distinct isbn numbers from my table. I wrote the following code:

      * @ejb.finder
      * signature="java.util.Collection findByIsbn()
      * query="SELECT DISTINCT OBJECT (i.isbn) FROM OrderItem AS i"
      *

      'isbn' is the column name and OrderItem is the abstract name of the bean.

      any suggestions.

        • 1. Re: finder method
          canobi

          Put that query in a select (eg. ejbSelectDistinctIsbn) method, not a finder, and it should work.

          • 2. Re: finder method
            qmqasim

            Thanks for the suggestion. However, my understanding is that Select methods cannot be used within clients.

            Perhaps, I could create a select method and use it within the bean to get a Collection of isbn.

            • 3. Re: finder method
              canobi

              Yep, that's exactly right. Expose another method in your CMP bean that will call the ejbSelect and return a Collection as a result.