[appengine-java] Re: Is it possible to have collections of embedded objects?
what do you mean by "store a list of embedded objects"? if you're storing in the datastore, you have to have a way to serialize whatever you got into one of the supported storable types. On Apr 7, 11:04 am, tempy wrote: > I have been dealing with lots of varying exceptions trying to > implement/store a list of embedded objects. I found one post on this > group claiming that this isn't supported (but the claim didn't come > from someone at Google), and I saw no mention of lists of embedded > objects in the google docs... So, does anyone know for sure, if this > is actually supported, or not? > > Thanks, > Mike -- 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: Is it possible to have collections of embedded objects?
Well, what I need is something like this: @PersistenceCapable(detachable = "true") public class Parent { @PersistenceCapable @EmbeddedOnly public class EmbeddedChild {...} @Embedded private List Children; ... } This doesn't work, so... Do I understand you correctly, that to accomplish this I have to serialize "Children" into a Text value or something like that? On Apr 7, 7:40 pm, Tristan wrote: > what do you mean by "store a list of embedded objects"? > > if you're storing in the datastore, you have to have a way to > serialize whatever you got into one of the supported storable types. > > On Apr 7, 11:04 am, tempy wrote: > > > > > I have been dealing with lots of varying exceptions trying to > > implement/store a list of embedded objects. I found one post on this > > group claiming that this isn't supported (but the claim didn't come > > from someone at Google), and I saw no mention of lists of embedded > > objects in the google docs... So, does anyone know for sure, if this > > is actually supported, or not? > > > Thanks, > > Mike -- 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: Is it possible to have collections of embedded objects?
i work with low-level datastore api, so i serialize things myself, but essentially yes. The issue you're probably running into is that the thing that you're using to interact with the datastore, does not know how to store EmbeddedChild. I would start there. from low-level datastore api point of view, you can only store a list of String, Blob, Text, Integer the storable types. but I think with the persistance manager you're using, the condition is that it has to implement Serializable or IsSerializable interface (not sure which one). On Apr 7, 1:13 pm, tempy wrote: > Well, what I need is something like this: > > @PersistenceCapable(detachable = "true") > public class Parent { > > @PersistenceCapable > @EmbeddedOnly > public class EmbeddedChild {...} > > @Embedded > private List Children; > > ... > > } > > This doesn't work, so... Do I understand you correctly, that to > accomplish this I have to serialize "Children" into a Text value or > something like that? > > On Apr 7, 7:40 pm, Tristan wrote: > > > > > what do you mean by "store a list of embedded objects"? > > > if you're storing in the datastore, you have to have a way to > > serialize whatever you got into one of the supported storable types. > > > On Apr 7, 11:04 am, tempy wrote: > > > > I have been dealing with lots of varying exceptions trying to > > > implement/store a list of embedded objects. I found one post on this > > > group claiming that this isn't supported (but the claim didn't come > > > from someone at Google), and I saw no mention of lists of embedded > > > objects in the google docs... So, does anyone know for sure, if this > > > is actually supported, or not? > > > > Thanks, > > > Mike -- 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: Is it possible to have collections of embedded objects?
On 8 Apr 2010, at 00:40, Tristan wrote: what do you mean by "store a list of embedded objects"? if you're storing in the datastore, you have to have a way to serialize whatever you got into one of the supported storable types. If you want to be able to query on the embedded instances then you will need to use one of the datastore specific persistence interfaces: ObjectDatastore from Twig and Objectify support this... not sure if others support embedded collections. -- 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: Is it possible to have collections of embedded objects?
You can serialize object graphs, but keep in mind that you won't be able to index/query this data and it will be opaque to the datastore viewer. It will also be opaque to GAE/Python tools. As John mentioned, you can get embedded object collections without Java serialization if you use Objectify or Twig. Here is a document that describes how they work in Objectify, including the implementation details (I suspect Twig is similar): http://code.google.com/p/objectify-appengine/wiki/introductiontoobjecti...@embedded Jeff On Wed, Apr 7, 2010 at 11:36 AM, Tristan wrote: > i work with low-level datastore api, so i serialize things myself, but > essentially yes. The issue you're probably running into is that the > thing that you're using to interact with the datastore, does not know > how to store EmbeddedChild. I would start there. > > from low-level datastore api point of view, you can only store a list > of String, Blob, Text, Integer the storable types. but I think > with the persistance manager you're using, the condition is that it > has to implement Serializable or IsSerializable interface (not sure > which one). > > On Apr 7, 1:13 pm, tempy wrote: >> Well, what I need is something like this: >> >> @PersistenceCapable(detachable = "true") >> public class Parent { >> >> @PersistenceCapable >> @EmbeddedOnly >> public class EmbeddedChild {...} >> >> @Embedded >> private List Children; >> >> ... >> >> } >> >> This doesn't work, so... Do I understand you correctly, that to >> accomplish this I have to serialize "Children" into a Text value or >> something like that? >> >> On Apr 7, 7:40 pm, Tristan wrote: >> >> >> >> > what do you mean by "store a list of embedded objects"? >> >> > if you're storing in the datastore, you have to have a way to >> > serialize whatever you got into one of the supported storable types. >> >> > On Apr 7, 11:04 am, tempy wrote: >> >> > > I have been dealing with lots of varying exceptions trying to >> > > implement/store a list of embedded objects. I found one post on this >> > > group claiming that this isn't supported (but the claim didn't come >> > > from someone at Google), and I saw no mention of lists of embedded >> > > objects in the google docs... So, does anyone know for sure, if this >> > > is actually supported, or not? >> >> > > Thanks, >> > > Mike > > -- > 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.
Re: [appengine-java] Re: Is it possible to have collections of embedded objects?
Hi John, > > If you want to be able to query on the embedded instances then you will need > to use one of the datastore specific persistence interfaces: ObjectDatastore > from Twig and Objectify support this... not sure if others support embedded > collections. > Slim3 supports embedded collections as follows: @Attribute(lob = true) private List Children; See http://sites.google.com/site/slim3appengine/slim3-datastore/defining-data-classes/serializable-objects Yasuo Higa -- 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: Is it possible to have collections of embedded objects?
On 8 Apr 2010, at 13:51, Yasuo Higa wrote Slim3 supports embedded collections as follows: @Attribute(lob = true) private List Children; See http://sites.google.com/site/slim3appengine/slim3-datastore/defining-data-classes/serializable-objects Serializing is a bit different to embedding instances because the Blob is opaque and not able to be queried. If you use @Embed in Twig or Objectify you can query for all Container instances by filtering on an embedded property. e.g. "Find all Bands with Albums that have sold over a million copies" class Band { @Embed List albums } class Album { String name; int sold. } datastore.find() .type(Band.class) .addFilter("albums.sold", GREATER_THAN, 100) .returnResultsNow(); -- 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: Is it possible to have collections of embedded objects?
Hi John, thanks for your clarification. Current Slim3 does not support embedding instances like Twig/Objectify. Yasuo Higa > > Serializing is a bit different to embedding instances because the Blob is > opaque and not able to be queried. If you use @Embed in Twig or Objectify > you can query for all Container instances by filtering on an embedded > property. > > e.g. "Find all Bands with Albums that have sold over a million copies" > > class Band > { > �...@embed List albums > } > > class Album > { > String name; > int sold. > } > > datastore.find() > .type(Band.class) > .addFilter("albums.sold", GREATER_THAN, 100) > .returnResultsNow(); -- 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.