[appengine-java] Re: Does that datastore mains sort order for list properties?
Hi, Even though an array is not a Collection per say, it seems that because of http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Entity.html#setProperty%28java.lang.String,%20java.lang.Object%29, you have to be careful with the order of items in an array as it says "All Collections are prone to losing their sort order and their original types as they are stored in the datastore. For example, a TreeSet may be returned as a List from getProperty(java.lang.String), with an arbitrary re-ordering of elements. " Hope it helps didier On Nov 15, 3:21 pm, Maxim Veksler wrote: > Hello, > > We are using the low level API, it unclear from the documentation if the > sort order is maintained in list properties? > > So for example, if I serialize int[] intArray = { 1, 2, 3}, can I always > expect to receive back {1 , 2, 3} or is it possible that the order will be > randomized? > > Thank you, > Maxim. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Does that datastore mains sort order for list properties?
>From my reading and experience, the type of collection type used will determine if order is preserved. To maintain the ordering, a system field is added to the values. This may impact the CUD operations performance. I don't need to keep the order in my current app so I am using Set for my property list, which does not involve any overhead. R. On Nov 15, 10:11 am, Maxim Veksler wrote: > It does, thank you very much. > > On Mon, Nov 15, 2010 at 4:47 PM, Didier Durand wrote: > > > > > Hi, > > > Even though an array is not a Collection per say, it seems that > > because of > > >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... > > , > > you have to be careful with the order of items in an array as it says > > > "All Collections are prone to losing their sort order and their > > original types as they are stored in the datastore. For example, a > > TreeSet may be returned as a List from getProperty(java.lang.String), > > with an arbitrary re-ordering of elements. " > > > Hope it helps > > didier > > > On Nov 15, 3:21 pm, Maxim Veksler wrote: > > > Hello, > > > > We are using the low level API, it unclear from the documentation if the > > > sort order is maintained in list properties? > > > > So for example, if I serialize int[] intArray = { 1, 2, 3}, can I always > > > expect to receive back {1 , 2, 3} or is it possible that the order will > > be > > > randomized? > > > > Thank you, > > > Maxim. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine for Java" group. > > To post to this group, send email to > > google-appengine-j...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-appengine-java+unsubscr...@googlegroups.com > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Does that datastore mains sort order for list properties?
I've read that too, but I've been using JDO on AppEngine for a year now and my properties that are Lists have maintained their order and I have not seem them deviate, but I have read that warning in the docs so I don't know if this can be guaranteed. Sets however by their very nature have no ordering and can change. On Nov 15, 7:21 am, Maxim Veksler wrote: > Hello, > > We are using the low level API, it unclear from the documentation if the > sort order is maintained in list properties? > > So for example, if I serialize int[] intArray = { 1, 2, 3}, can I always > expect to receive back {1 , 2, 3} or is it possible that the order will be > randomized? > > Thank you, > Maxim. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: Does that datastore mains sort order for list properties?
It does, thank you very much. On Mon, Nov 15, 2010 at 4:47 PM, Didier Durand wrote: > Hi, > > Even though an array is not a Collection per say, it seems that > because of > > http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Entity.html#setProperty%28java.lang.String,%20java.lang.Object%29 > , > you have to be careful with the order of items in an array as it says > > "All Collections are prone to losing their sort order and their > original types as they are stored in the datastore. For example, a > TreeSet may be returned as a List from getProperty(java.lang.String), > with an arbitrary re-ordering of elements. " > > Hope it helps > didier > > On Nov 15, 3:21 pm, Maxim Veksler wrote: > > Hello, > > > > We are using the low level API, it unclear from the documentation if the > > sort order is maintained in list properties? > > > > So for example, if I serialize int[] intArray = { 1, 2, 3}, can I always > > expect to receive back {1 , 2, 3} or is it possible that the order will > be > > randomized? > > > > Thank you, > > Maxim. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.