Hi,
I’m a beginner in JDO. So I read the google tutorial
http://code.google.com/intl/de/appengine/docs/java/datastore/relationships.html
Well, I understand how to make a owned relationship.
Bur I didn’t understand how I should make a unowned relation.
So here’s the google example for unowned one-to-one relationship:
@PersistenceCapable
public class Person {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private Key favoriteFood;
// ...
}
@PersistenceCapable
public class Food {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
// ...
}
So a Person can have a favored Food. But a Food is not linked to only
one Person, but can be the favored Food of more than one Person.
Ok, I understand that we don’t have a Food-Object in the class Person,
but instead we have the Key to the food.
Ok, now I want to get the favored Food Object of a Person. How do I
get now the Food Object?
Is the only way to get it by calling the getObjectById() or to make a
query like “SELECT FROM Food WHERE key = person.getFavoredFoodKey()”
Is there another fully automatically way to get the Food-Object?
--
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.