I'm beginner in Android and I'm trying to understand how GAE works with Objectify.
So I've created two classes, one 'User' and another one 'Journey'. Each Journey belongs to a User.
User Class
@Entity
public class User {
@Id
private Long id;
@Index private String mac;
private String name;
private String firstName;
private Long age;
private String email;
private String password;
// Getters and setters
}
Journey Class
@Entity
public class Journey {
@Id
private Long id;
Key<User> driver;
private Event event;
private Long nbPlaces;
private String departureTime;
private String destination;
}
I've writed the following method on the User class, is this correct ?
@Transient Key getKey() { return Key.create(User.class, id); }
How can I set the Key of the User in my Journey Object ? (I think I can't use a simple setter.
Thanks !