Hi,
How do we make an entity group with a parent that has an encoded or
raw string for its primary key? The examples in the docs use Key (I
can get those to work). I need something like:
class User {
@PrimaryKey
private String username;
}
class FavAnimal {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String key;
@Persistent
@Extension(vendorName="datanucleus", key="gae.parent-pk",
value="true")
private String parentKey;
}
when I want to create a FavAnimal, I want to do something like:
FavAnimal fa = new FavAnimal();
fa.setParentKey(user.getUsername());
pm.makePersistent(fa); // generate 'key' upon saving.
where the FavAnimal's 'key' value would be left null, and generated by
the datastore. Again, I can get this to work with real Key types, but
I wanted to use Strings instead to try to maintain some portability.
When I try the above example, I'll get an exception thrown on
persisting:
Attempt was made to set parent to johndoe but this cannot be
converted into a Key
(here I used johndoe as the parent username),
Thanks
--
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 [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-java?hl=en.