I'm having trouble with understanding the upgrade process from JDO to Objectify.
So I have this class:
@PersistenceCapable
public class AppUser {
/**
* key from userID
*/
@PrimaryKey
@Persistent
private Key key;
//...
}
And I upgraded it to:
@Entity
public class AppUser {
/**
* key from userID
*/
@Index Key key;
@Id Long id;
// ...
}
Before the change I was able to retrieve the entity using following method:
Key _key = KeyFactory.createKey(AppUser.class.getSimpleName(), user.getUserId());
PersistenceManager pm = PMF.get().getPersistenceManager();
AppUser appUser = pm.getObjectById(AppUser.class, _key);
Where user
object is AppEngine's user object referenced with Google Account.
How can I query for an entity for given user? When I try to use filterKey
it results with null object.
Thanks in advance.