I have a datastore full of entities. They are all in an entity group
with many other entities - maybe 1000 per group. I am using keys and
parent keys to keep them organized:
@PersistenceCapable(detachable = "true")
public class Assessment
{
@SuppressWarnings("unused")
@Persistent
@Extension(vendorName = "datanucleus", key = "gae.parent-pk", value
= "true")
private Key parentKey;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
...
However, to communicate with the client, I've been using key.getId() to
get a numeric identifier. I've been assuming that each key would have a
different id, but have recently noticed that this is a bad assumption!
Many of my entities share an ID! Unfortunately, I noticed this just a
couple of days after opening my app to beta testers, so I have real
data on the line.
1: How can I ensure that every entity gets a unique id? Do I have to
implement my own id generator?
2: Now that I have many entities with the same id (but different keys)
is there any way to efficiently transmit something that uniquely
identifies each entity?
Thanks for any help or advice!
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.