Implementing Unowned relationship Google App Engine
        Posted  
        
            by nwallman
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by nwallman
        
        
        
        Published on 2009-08-03T02:03:25Z
        Indexed on 
            2010/05/02
            9:07 UTC
        
        
        Read the original article
        Hit count: 263
        
My question is more of a best practices question on how to implement unowned relationships with Google App Engine. I am using JDO to do my persistence and like recommended in the google docs I'm persisting my list of unowned relationships like so:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements Serializable, UserDetails {
...
    @Persistent
    private List<Key> groups;
...
}
Now I came across my predicament when I went to query that list of objects using they Key object. So when I get my list of group keys in order to actually return a list of Group objects I have to do a look up on that key to get the object. My question is what is the recommended way of doing a unowned look up on a model object?
Should I have an instance of the PersistanceManagerFactory on my Model object so I can do a lookup?
Should I have an instance of my GroupDAO object on my Model object so I can do a look up?
Should I have a Utility to do this type of lookup?
I'm new to this so I just want to know which is the best way to do this. Thanks.
© Stack Overflow or respective owner