Sorting the result of find methods

Discussions

EJB design: Sorting the result of find methods

  1. Sorting the result of find methods (6 messages)

    Hi all,

    I need to sort the result of my find methods.
    Should I do this:
    - within the deployment descriptor? Is this
      actually possible? I use JOnAs as EJB server.
    - within the Collection?

    Any tips would be appriciated!

    Lofi.
    http://openuss.sourceforge.net

    Threaded Messages (6)

  2. Sorting the result of find methods[ Go to top ]

    Try adding order by to your sql in the deployment descriptor XML
  3. Sorting the result of find methods[ Go to top ]

    I have been making custom finders with orderby's in the sql, however I don't like this solution, it seems like a hack to me (not very object oriented). Is there an orderby statement in EJB 2.0 QL language? If not, then relying on finders to do searching is only a BMP solution, and is not that portable.

      I am also interested in how people have been solving this problem.

    Floyd
  4. Why dont you use Weblogic's QL?
  5. Why dont you use Weblogic's QL?


       Because I am using BMP.

    Floyd
  6. Sorting the result of find methods[ Go to top ]

    I want to have an ejb container independent solution.
    If you use Weblogic's QL, you will stuck in that platform.

    I'm not sure whether all ejb server can handle "order by" statement in the deployment descriptor. Another problem is, how can I make a "select distincrow" (without duplicates) in the deployment discriptor?

    One way is using the collection framework (TreeSet) to sort and take the duplicates out of the result.

    Any other idea?
    Lofi.
  7. Sorting the result of find methods[ Go to top ]

    I am working on a data abstraction layer, for use within our EJB's, which precludes sorting at the data source. The approach I've taken is to return Collection objects from all of my list-type methods, and use Comparator objects to implement sorting behavior.