persistence@glassfish.java.net

Re: List field ordering

From: jeff <jeffrey.blattman_at_yahoo.com>
Date: Fri, 16 Mar 2007 09:09:21 -0700 (PDT)

hi varum,

related, but not what i was asking about, i think. i was suggesting that if a persist a List, forgetting about @OrderBy, when i retrieve it, at any point in the future, it should be in the same order. if it's not, then it violates the definition of a list.

maybe keeping track of the order of a list is not practical implementation-wise, but in that case it's misleading to allow one to define persistent fields of type List. JP should only allow Sets, Collections, or other unordered collection types.

Varun Rupela <Varun.Rupela_at_Sun.COM> wrote: Hi:

2620 is a Enhancement Request related to this topic.
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2620

thanks.

varun.

Marina Vatkina wrote:
> Hi Jeff,
>
> I agree that this feature is somewhat partially defined by the spec. So I
> suggest to send your thoughts to the JSR feedback alias ;).
>
> thanks,
> -marina
>
> jeff wrote On 03/14/07 16:09,:
>
>> thanks marina,
>>
>> if that's the case, wouldn't it make sense to disallow field types of
>> List? a List is ordered, by definition. it is sort of misleading to
>> allow one to specify it as List and then state the retrieved order is
>> undefined.
>>
>>
>> */Marina Vatkina /* wrote:
>>
>> Unfortunately not - a) if you are not specifying the orderBy, the
>> list can be
>> returned by the database retrieved order; b) but even if you do, the
>> spec allows
>> to use cashed values, so if you didn't order the list before the
>> commit, you
>> might get back a copy of the committed view.
>>
>> -marina
>>
>> jeff wrote On 03/14/07 15:22,:
>> > if i have a field ...
>> >
>> > List foos = new ArrayList();
>> >
>> > am i guaranteed that when i persist and then retrieve the object that
>> > the ordering of list elements will be maintained? i am seeing that
>> it is
>> > not.
>> >
>> > thanks.
>> >
>> >
>> >
>> ------------------------------------------------------------------------
>> > Be a PS3 game guru.
>> > Get your game face on with the latest PS3 news and previews at Yahoo!
>> > Games.
>>
>>
>> ------------------------------------------------------------------------
>> Finding fabulous fares is fun.
>> Let Yahoo! FareChase search your favorite travel sites
>> >>
>>> to find flight and hotel bargains.
>>>


 
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.