Re: [appengine-java] Re: many different Properties or Entity for name/value pairs
It's possible to make it searchable, you will need to store and update two entities. MyEntity will have a Properties to Values map, and you have a PropertiesEntity that has a MyEntity to Values map. class MyEntity { @Id Long id; @Serialized MapString,Object properties } class MyProperties { @Id String id; @Serialized MapLong,Object values } Searching by property will become very cheap and fast since you'll simply fetch the property entity. Updates and Writes will be more complex since you will need to write 2 entities, but there should only be a total of 4 write ops. The other way is likely to be more expensive since you will use (2 + 2 * properties) write ops for each entity because each property will need to be indexed. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/gIqiaTmB3SIJ. To post to this group, send email to google-appengine-java@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: many different Properties or Entity for name/value pairs
You can serialize a MapString,String property into a byte array to be stored in the entity The easiest way to do this would be to use Objectify with the @Serialized annotation http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Embedded -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/_tZZPKf5r6cJ. To post to this group, send email to google-appengine-java@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: many different Properties or Entity for name/value pairs
You can serialize a MapString,String property into a byte array to be stored in the entity The easiest way to do this would be to use Objectify with the @Serialized annotation http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Serialized -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/gJlXN2L1eBsJ. To post to this group, send email to google-appengine-java@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: many different Properties or Entity for name/value pairs
hi gerald, thx for your answer but this is the ugliest solution ;) why serializing all pairs and storing them in one.property it will never be searchable... using one entity property for every map.entry or using one entity of a key value pair type, thats the question ;) schtief Am 04.11.2011 07:10 schrieb Gerald Tan woefulwab...@gmail.com: You can serialize a MapString,String property into a byte array to be stored in the entity The easiest way to do this would be to use Objectify with the @Serialized annotation http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Embedded -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/_tZZPKf5r6cJ. To post to this group, send email to google-appengine-java@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-java@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: many different Properties or Entity for name/value pairs
From previous threads, it seems that the datastore prefers few large entities to more smaller ones - this is also reflected in pricing, you pay per operation as well as per byte. Storing a Map of Name-Value is exactly what the datastore is made for. I did talk to Jeff at Objectify about this (because I'm using Objectify for all my other entities) and he said that although this use case is probably valid and I'm (clearly now) not the only one doing it, making Objectify handle this case would complicate it too much. I think I agree with this, especially since the datastore handles properties like this so nicely. In addition, I can now make use of Objectify's CachingDatastoreService which means I don't have to worry about Memcache :-) One thought - can you search based on an item in a collection? If not and you do need to search based on these values, you might need to be more creative about how to split them. MyName-MyValue1 and MyName-MyValue2 which might become... MyName-Collection([MyValue1, MyValue2]) or perhaps... MyName.1-MyValue1 and MyName.2-MyValue2 if MyName.1 will never be a property name itself, and you can deal with parsing this. Thanks, Mat. On 4 November 2011 07:53, Mister Schtief lisc...@gmail.com wrote: hi gerald, thx for your answer but this is the ugliest solution ;) why serializing all pairs and storing them in one.property it will never be searchable... using one entity property for every map.entry or using one entity of a key value pair type, thats the question ;) schtief Am 04.11.2011 07:10 schrieb Gerald Tan woefulwab...@gmail.com: You can serialize a MapString,String property into a byte array to be stored in the entity The easiest way to do this would be to use Objectify with the @Serialized annotation http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Embedded -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/_tZZPKf5r6cJ. To post to this group, send email to google-appengine-java@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-java@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-java@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: many different Properties or Entity for name/value pairs
FWIW you can declare a field @Embedded MapString, anything in Objectify and this will create a series of native properties in the low level entity. Ie: class MyEntity { @Id Long id; @Embedded MapString, Long strings; } If the map contained { prop1 : 12 } then you could filter by: ofy.query(MyEntity.class).filter(strings.prop1, 12) Of course the value could be a SetString instead of Long. But yeah, this will make the datastore viewer difficult to read if you have wildly different properties for each entity. Nothing you can do about that if you don't want to make the collection an opaque serialized blob. Jeff On Fri, Nov 4, 2011 at 1:44 AM, Matthew Jaggard matt...@jaggard.org.uk wrote: From previous threads, it seems that the datastore prefers few large entities to more smaller ones - this is also reflected in pricing, you pay per operation as well as per byte. Storing a Map of Name-Value is exactly what the datastore is made for. I did talk to Jeff at Objectify about this (because I'm using Objectify for all my other entities) and he said that although this use case is probably valid and I'm (clearly now) not the only one doing it, making Objectify handle this case would complicate it too much. I think I agree with this, especially since the datastore handles properties like this so nicely. In addition, I can now make use of Objectify's CachingDatastoreService which means I don't have to worry about Memcache :-) One thought - can you search based on an item in a collection? If not and you do need to search based on these values, you might need to be more creative about how to split them. MyName-MyValue1 and MyName-MyValue2 which might become... MyName-Collection([MyValue1, MyValue2]) or perhaps... MyName.1-MyValue1 and MyName.2-MyValue2 if MyName.1 will never be a property name itself, and you can deal with parsing this. Thanks, Mat. On 4 November 2011 07:53, Mister Schtief lisc...@gmail.com wrote: hi gerald, thx for your answer but this is the ugliest solution ;) why serializing all pairs and storing them in one.property it will never be searchable... using one entity property for every map.entry or using one entity of a key value pair type, thats the question ;) schtief Am 04.11.2011 07:10 schrieb Gerald Tan woefulwab...@gmail.com: You can serialize a MapString,String property into a byte array to be stored in the entity The easiest way to do this would be to use Objectify with the @Serialized annotation http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#@Embedded -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/_tZZPKf5r6cJ. To post to this group, send email to google-appengine-java@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-java@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-java@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-java@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: many different Properties or Entity for name/value pairs
This is pretty awesome feature, but did you forget to document it? :) -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/z7iXjUGzMLQJ. To post to this group, send email to google-appengine-java@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.