Re: how to re-order a relationship

From: Erik Hatcher (eri..hatchersolutions.com)
Date: Thu Apr 28 2005 - 08:27:44 EDT

  • Next message: Filip Balas: "Re: Hierarchical relationship problems"

    On Apr 27, 2005, at 12:03 PM, Joshua Pyle wrote:
    > I don't know if there is another way to do it but...
    > �
    > I overide the cayenne class accessor that returns the relationship and
    > I do and in memoory sort.� here is an example
    > �
    > ��� public List getRevInspections() {
    > ������� List toBeSorted = super.getRevInspections();
    > ������� Ordering comparator = new Ordering(Insp.INSP_DT_PROPERTY,
    > Ordering.DESC);
    > ��������Collections.sort(toBeSorted, comparator);
    > ������� return toBeSorted;
    > ��� }
    >

    One less line of code you can do it this way and avoid an intermediate
    Comparator.

       public List getSections() {
         List sections = super.getSections();
         Ordering ordering = new Ordering(Section.ORDER_PROPERTY,
    Ordering.ASC);
         ordering.orderList(sections);
         return sections;
       }



    This archive was generated by hypermail 2.0.0 : Thu Apr 28 2005 - 08:28:05 EDT