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;
> ��� }
Nice technique. Works like a charm!
Erik
>
>
> --
> Joshua T. Pyle
> Go has always existed.
> �
> On 4/27/05, Erik Hatcher <eri..hatchersolutions.com> wrote:
> Here's my model - a "page" has multiple "sections".��Sections are user
> orderable, and I provide a user interface to move them around.��My plan
> is to add an "order" integer column to the SECTION table.
>
> Initially the sections table would look something like this:
>
> ������ id������order
> ������ 1������ 1
> ������ 2������ 2
> ������ 3������ 3
>
> then a user chooses to move section 3 up one, so it'd look like this:
>
> ������ id������order
> ������ 1������ 1
> ������ 2������ 3
> ������ 3������ 2
>
> How are folks handling this type of thing?��I don't see a way to
> specify an order for a relationship join, so how could I get the List
> from a page.sections() call to come back in "order" order?
>
> And how do you handle updating the database in this type of situation?
> I presume that I will simply swap "order" numbers on two different
> section objects when a move-up or move-down action happens.
>
> Thanks for your help.
>
> ������ Erik
This archive was generated by hypermail 2.0.0 : Wed Apr 27 2005 - 13:53:37 EDT