You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Coup, Robert Muir" <r....@auckland.ac.nz> on 2003/12/23 23:58:54 UTC

Ordered Lists and Index Fields

Hi all,

What is the best way of storing an ordered list without using Dlist
which requires additional tables & SQL lookups? 
OrderBy works great if the positioning has some underlying field (eg.
Object id, name) but if the only thing specifying the position is the
list index then it doesn't work too well.

One option is to link a fake field-descriptor to the item's position in
a list and use orderby... 
Another is to create a new ManageableCollection that is linked somehow
to a database field which it stores indexes in... but that breaks the
idea that the mapping is in the repository.

Another is to do something like...
	<collection-descriptor 
	 name="myList"
	 element-class-ref="com.example.MyObject"
	 collection-class="com.example.MyMagicList"
	 index-field="listIndexField"
	 />
Then store the index of each item in the list in the database field
specified by index-field. When you re-instantiate it is effectively an
orderBy.
A ManageableList interface extending ManageableCollection may be needed
which knows about and uses the index-field attribute... 
And it probably needs to ignore/complain about additional orderBy
fields...

Suggestions? Alternatives?

Thanks again,
Rob :)

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org