Re: getting a List of Comparables, feature request?

From: Bryan Lewis (brya..aine.rr.com)
Date: Sun Mar 13 2005 - 14:21:46 EST

  • Next message: Todd O'Bryan: "Re: getting a List of Comparables, feature request?"

    I don't know how much this will help you, but I'm taking your question as a
    "best practices" question.

    When we started rewriting our apps onto a Cayenne+Tapestry base, we set
    ourselves a rule that there would be no Cayenne-related code in the page
    classes. No cayenne imports in any source file that also has tapestry
    imports. This is something we learned from the headaches in our previous
    WebObjects implementation (even though the model/view separation was
    moderately good there).

    This avoids the situation of query code being buried all over the place.
    The queries are all in the model layer, deployed in a separate model.jar.
    This gives us maximum reuse of queries. When we want a list to be sorted in
    a certain way (like a list of countries sorted by name), we do a simple
    addOrdering() in the one query method. I'm glossing over some details, but
    you get the idea.

    ----- Original Message -----
    From: "Todd O'Bryan" <toddobrya..ac.com>
    To: <cayenne-use..bjectstyle.org>
    Sent: Saturday, March 12, 2005 10:21 PM
    Subject: getting a List of Comparables, feature request?

    > I find myself writing a lot of code to put Lists of objects that I get
    > from a query into their natural ordering. How big a performance hit
    > would it be to check if the type of the class in a relationship
    > implements Comparable and then sort the List before it's returned from
    > CayenneDataObject?
    >
    > My problem is that the code to do this is buried all over the place in
    > Tapestry page classes and if I forget to sort the Lists in one instance
    > bad things can happen such as data being corrupted.
    >
    > Is there a better way to deal with this?
    >
    > Thanks,
    > Todd
    >



    This archive was generated by hypermail 2.0.0 : Sun Mar 13 2005 - 14:21:59 EST