I think what I'm look for is somthing that makes the persistance more transparent. Since I'm using a Java construct that maintains order, I don't want to have to add some sort-field to my model objects just for that purpose. I realize an additional column will be necessary in the database schema, but I don't think it should be necessary in Java.

Thus, what I think we need, is when the Collection is written out, it writes out to the "extra column" automatically.

I firmly believe the less the schema/OJB affects my Java model, the better.

David

Thomas Mahler wrote:

Hi David,

The OJB collection-descriptor has attributes "orderby" and "sort":
orderby CDATA #IMPLIED
sort (ASC | DESC) "ASC"

(See repository.html for details) These attributes allow to setup sorting on collections.

All you have to do is to have a column in the item-table that can be used for a "ORDER BY X" Sql clause and to have a field in the items class that maps to this column.
In the collection-descriptor you tell OJB to sort the items in the collection according to this field.

cheers,
Thomas



David Corbin wrote:

I know OJB supports lists/collections in various manners. But it is my guess, that it is completely unordered - that is, even when the Java object is a List (ordered), nothing is done to ensure that the database reflects this order, and that upon reload, the order may be different.

We are going to have several places where the list is ordered (arbitrarily, by the user), and we need to preserve this ordering. What's the best way to do this in OJB?

David


--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>






--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to