Dear All,

I am facing a strange issue using the KeyFactory.createKey() method : keys
generated by this method are stored as unowned relationships, but are
actually not recognized by the datastore viewer (the key-URL does not work).

Hopefully you could help me on this.
A few words about my source below.

Entity A is a root entity.
Entity B is a child of entity A.
Entity C is another root entity.

I use JDO for persistence.
All my entity primary keys are declared this way :
    
    ...
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    ...

In my entity C, I need to store an unowned relationship to an entity B.
My parameters when creating C : the key IDs (type 'Long') of A and B.

My code to create entity C is quite simple, as follow :

    ...
    Key aKey = KeyFactory.createKey(ClassA.class.getSimpleName(), akeyId);
    Key bKey = aKey.getChild(ClassB.class.getSimpleName(), bKeyId);
    entityC.setEntityBKey(bKey);
    pm.makePersistent(entityC);
    ...

So far it's ok, but the bKey stored in entity C is not recognized by other
programs. Any clue ?

Thanks for your help.
Cyrille




-- 
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.

Reply via email to