>
> I think it's a reasonable expectation, as long as we're talking
> specifically about mapping a *List* and not just a generic Collection.
>

Ah, this topic again :) I know I'll be all lone, but I'll try anyway!

If we do it for List, and unless there are technical issues that prevent us
from doing so, I would be in favor of doing it for any kind of collection.

In Collections, the fact that iteration order is deterministic is mostly up
to the implementation, which is different from saying it's not
deterministic. From the javadoc for Collection#iterator():

There are no guarantees concerning the order in which the elements are
> returned
> (unless this collection is an instance of some class that provides a
> guarantee).


Deterministic, and even predictable order is not exclusive to List, either:
for instance, LinkedHashSet is not a List, it has a specific iteration
order, but there is nothing in its implemented interfaces (Collection, Set)
that defines this order.

My point is, we can't rely on the implemented interface to decide whether
the iteration order is important or not, so we may as well decide it is
always important. Unless there are annoying technical challenges, of course.


Yoann Rodière <yo...@hibernate.org>
Hibernate NoORM Team

On 13 January 2017 at 13:48, Sanne Grinovero <sa...@hibernate.org> wrote:

> I think it's a reasonable expectation, as long as we're talking
> specifically about mapping a *List* and not just a generic Collection.
>
> On 13 January 2017 at 12:18, Davide D'Alto <dav...@hibernate.org> wrote:
> > Hi,
> > it seems that when using Collection of elements in MongoDB, users
> > expect to have the elements in the same order as in the db. You can
> > see the question on the forum here:
> > https://forum.hibernate.org/viewtopic.php?f=31&t=1043903&;
> p=2491218#p2491218
> >
> > I also found this StackOverflow question:
> > http://stackoverflow.com/questions/9013916/do-arrays-
> stored-in-mongodb-keep-their-order
> >
> > What do you think? Is it something that we should support?
> >
> > Cheers,
> > Davide
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to