Hi David,

David Corbin wrote:
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.
There is no direct correspondence of an ordered collection to a list of entries in a RDBMS. Thus we need an additional column that reflects the element order.

I realize an additional column will be necessary in the database schema, but I don't think it should be necessary in Java.
This is a common argument. You might also say: Object identity is a Java feature, thus I don't want to have primary key attributes in my entity classes.

There has been a design decision in OJB to rely on primary key attribute in entity classes. It makes things *much* (by orders of magnitude wrt. to complexity) simpler for us.

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

Implementing such a feature would take a lot of work, as it is outside our original paradigma to rely on mapped attributes.
IMO the benefit would be low. It would only safe you an additional private member for certain entity classes.
IMO the effort/benefit ratio would not be very good.

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

I agree! Of course it would be nice to have full transparency. But this would be an enourmous effort.
Even TopLink does not provide it! And they have a large team of payed developers.
We have only a handful of talented volunteers!

cheers,
Thomas


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>







--
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