Antonio Gallardo wrote:
Using "orderby" attribute -
http://db.apache.org/ojb/docu/guides/repository.html#collection-descriptor
There is no need of an extra field.
you can do it same way in hibernate. see:
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#collections-sorted
<quote>
If you want the database itself to order the collection elements use
the order-by attribute of set, bag or map mappings. This solution is
only available under JDK 1.4 or higher (it is implemented using
LinkedHashSet or LinkedHashMap). This performs the ordering in the SQL
query, not in memory.
<set name="aliases" table="person_aliases" order-by="lower(name) asc">
<key column="person"/>
<element column="name" type="string"/>
</set>
</quote>
Moreover you can use a TreeSet that allows you to implement sorting not
available to SQL (via use of Comparable interface).
Still your bean needs to have properties that define the order.
Let me give you an example that advocates the use of index field.
- a Person class (firstName, lastName, age)
- Marathon class:
- name
- place
- date
- thoseWhoFinishedTheRace collection which is a sorted list of those
Persons who managed to get to the finish line. The list is sorted in an
order of finishing so thoseWhoFinishedTheRace().get( 0 ) is the winner.
In this example the collection is not _sorted_ - it is _ordered_ with
information not available to Person bean. The use of index field is
mandatory - it's not bad database design.
In my case, I met the Unsupported Operation Exception in jxpath using
@direction="save" not while loading a not with a repeater, but using a
cform multivalue field.
Could you give me some test case? I tried to stay out of MultiValueField
binding as it always rewrites the whole collection which causes multiple
deletes/inserts.
--
Leszek Gawron [EMAIL PROTECTED]
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65