Leszek Gawron wrote:
Vadim Gritsenko wrote:
Leszek Gawron wrote:
- 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.
It is bad - good design will have 'finished' timestamp ;-P
LOL. Still there are several usecases when you do not have a field to
sort on like "a list of shirts I like best starting from the most
favourite one". :)
Not sure is there can be a usecase where you will not need to store a
value in the DB. But, let assume the special usecase exists, then the
additional index should be "optional" and not obligatory as is now in
hibernate. ;-)
I also noted [0]: "The index of an array or list is always of type integer."
Again, this is a non-sense: Obligatory index + obligatory index type!
Of course, this does not cover cases where the user prefer to use
another index type, for example a string or a char or whatever other
type the user want to use. This is another reason to choose Apache OJB
[1]. The worse is that instead of offer a solution in hibernate 3, they
offer just "a cool justification" why this non-sense [0]. I really
wonder how is people using hibernate after all. The only answer I found
is "they must have an excelent marketing engine a la
${readerPreferedCorporate.getName()}". ;-)
IMO, a good O/R mapping tool should not force us to "hack" our database
or our code. ;-)
Best Regards,
Antonio Gallardo.
[0] http://www.hibernate.org/hib_docs/reference/en/html/collections.html
[1] http://db.apache.org/ojb/