Robert S. Sfeir schrieb:

Hello,

> > Steps 1.) and 2.) are imo ok. the sql contains an order by and
> > ArrayList  also maintains the order.
> > The problem is in step 3.) how could we warn the user that his list
> > may cause sorting problems ?
>
> Yup exactly what I was originally thinking, I do think however that
> we can just change from a HashSet to a SortedSet, then the ArrayList
> and *Set Impl will work.  HashSet is fine for speed I guess if there
> is no ordering.  So maybe we check to see if we have orderedby and
> get a SortedSet, if not HashSet.  Then document behavior?  If not
> possible, then definitely throw an exception to get the user's
> attention.

I have a similar Problem (i think).
When retrieving a Collection for the first time, the order is fine like 
i want it.
When retrieving it a second or third, or ... time i seem to get a random 
order.
I have this Problem when displaying the collection of objects on cocoon 
with cforms in a repeater.
Updating in the database works fine, the field by which i want to sort 
is ok.

My Repository looks like this:

<collection-descriptor 
   name="profileMenuCategories" 
   element-class-ref="nymphoon.ProfileMenuCategory" 
   auto-retrieve="true" 
   auto-delete="true" 
   auto-update="true"
   orderby="sortNumber"
          sort="ASC"
   >
   <!-- foreign key in the other side referencing this class -->
                        <inverse-foreignkey field-ref="profileId"/>
</collection-descriptor>

sortNumber is a Field in the class ProfileMenuCategory.

<class-descriptor class="nymphoon.ProfileMenuCategory" 
table="rel_profiles_menu_categories">
...
  <field-descriptor name="sortNumber" default-fetch="true" 
column="sortnumber" jdbc-type="INTEGER"/>

For the collection in the java Class i use an ArrayList.

Did i do something wrong? Or how can i track the Problem further down?

Christoph

Attachment: pgpRXt3sOqiUy.pgp
Description: PGP signature

Reply via email to