I am trying to understand the concepts of owned and unowned relationships in JDO/GAE using the following model:
Definition for EMPLOYEE
class Employee {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key key;
   @Persistent
   private String firstName;
   @Persistent
   private String lastName;
   @Persistent
   private User user;
}
Definition for USER
class User {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key key;
   @Persistent
   private String userName;
   @Persistent
   private String password;
   @Persistent
   private Key role;
}
Definition for ROLE
class Role {
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key key;
   @Persistent
   private String roleName;
   @Persistent
   private String status;
}
Each Employee has an User account and each user account is associated with a role.
The requirement is such that, when I list the employees, it should show the User.username as well as Role.rolename associated with that record.
I have the following questions related to this model:
- After going through GAE official documentation I assume that the relationship between Employee and User is owned and that of User and Role is unowned. Is my assumption correct? 
- Does this model makes sense in GAE/JDO? 
- How can I write a query to list the employees in the above mentioned requirement? 
In addition to the official documentation I have also refer开发者_如何学Gored http://thoughts.inphina.com/2010/08/04/gae-unowned-relationships-preferred/
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论