objectify - Generate unique Long Id on App Engine -
i've 3 possible ways user can sign in our service:
- login , password
 - google+
 
i want keep user id's in 1 entity. avoid id collisions between e.g. google , facebook prefix added id (g- , f- respectively). users standard login, unique long value generated app engine (using objectify @id long value set null id).
to keep in 1 entity key must same type should string. there's no option in objectify auto generate key string. 
what need generate unique long value given entity prefixed c- (custom login). that'd give string id similar of google , facebook. i've searched objectify's code found nothing related generate unique long id null long fields annotated @id.
if want value equivalent autogenerated id, call:
factory().allocateid(thing.class).getid();   alternatively, can use allocateids method on underlying datastoreservice of low level api. or uuid.randomuuid().
however, sounds weird. want able map facebook id or google id human object. lookup entity - facebookid or googleid string id exact id handed out fb or g. should not synthetic key, otherwise how up?
Comments
Post a Comment