Re: [appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-15 Thread Drew Spencer
Thanks Jeff, I think I will use Longs as you suggest. I was originally thinking why add an extra piece of data when there's a unique value there? Well, now I know why! Just one question - the DatastoreService.allocateIdRange() - when would this be used? I have read the javadoc and understand

Re: [appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-15 Thread Jeff Schnitzer
One case is when you need to save several different entities that all reference each other. Let's say A has a reference to B, and B has a reference to A. If you relied on key autogeneration you would need 3 puts: * Put A (which initializes the id) * Set B.a to the id of A, put B * Set A.b to

[appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-15 Thread Thomas Wiradikusuma
Sorry for the stupid question, but in what scenarios would we need to allocate id? Usually if I need the id to be something, i just use string (e.g. email address), otherwise, just let datastore set it for me (when persisting). On Jun 15, 6:26 pm, Drew Spencer slugmand...@gmail.com wrote: Just

[appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-06 Thread Drew Spencer
Thanks Remy, I've just had a little play about with the java.util.UUID class. Seems pretty straightforward. I'll have a look into it a bit more later on, but maybe it will be overkill for my app - it's only a company internal one so maybe passing so many characters around might slow my app a

Re: [appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-06 Thread Felipe Teixeira
Search in google : FishBone GWT objectify , A good exemple to use this. =D 2011/6/6 Drew Spencer slugmand...@gmail.com Thanks Remy, I've just had a little play about with the java.util.UUID class. Seems pretty straightforward. I'll have a look into it a bit more later on, but maybe it

Re: [appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-06 Thread Jeff Schnitzer
I just let the datastore do it. I like having Long ids: * Longs always stick out in code as an id - ie in a constructor with 15 things, it sucks when they are all Strings. I often wish Java supported C-style typedefs (or just allowed subclassing basic types). * Long keys are more

[appengine-java] Re: When to use a String as ID? (using Objectify and GWT)

2011-06-03 Thread Remy Gendron
Make sure you understand the concepts of natural vs synthetic keys. Then, you may also consider using a String instead of a Long as your synthetic primary keys. Using the string representation of a UUID as a synthetic key will also allow you to do things like you mentionnned, eg creating