John, Thanks a bunch. Here is the reason why I need to add a prefix to the key. The scenario -
I will be implementing pagination (of the data returned) as described in and for the sort order I wanted to use the Key. However, if the key also has the date of creation embedded in it then the sort will be on the date as well. I do not want to generate an unique key in my application. I want the data store to do it. I just want my app to piggyback on the datastore's ability to generate unique keys. Does this make sense or am I missing something here? Thanks again, Manny On Mon, Feb 8, 2010 at 1:44 PM, John Patterson <jdpatter...@gmail.com>wrote: > You could use DatastoreService.allocateIds() > > But why would you want to do this? If its to make the ids look nice then > you could just add and remove the string yourself before looking up the key. > Probably better to have a date property rather than include it in the key. > > > On 8 Feb 2010, at 14:54, Manny S wrote: > > First off thanks for your time. >> >> I would like to generate a key that is a concatenation of a string with an >> datastore generated key. Is there anyway to do that? >> >> I want my keys to be "appname" + datastore generated key or say generate >> a key that is currentdate + datastore generated key >> >> Any suggestions as to how I should go about this? A simple example would >> be greatly appreciated. >> >> Manny >> >> -- >> 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<google-appengine-java%2bunsubscr...@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<google-appengine-java%2bunsubscr...@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.