2つの1対多の関係を持つエンティティを作成しています。イベントには、ユーザーフィールドと場所フィールドがあります。自動クエリを使用しようとしていますが、このコードは常に空のリストを返します。
    User user = new User("mauriziopz@gmail.com","Maurizio Pozzobon","01","hash","facebook");
    user.insert();
    Place place = new Place("posto","bel posto",null,null);
    place.insert();
    Event e =new Event(user,place, "Festa","Questa è una gran bella festa",null,new Date(),(long) 10,false,null);
    e.insert();
    List<Event> l =user.events.fetch();
イベントクラスは
public class Event extends Model{
    @Id
    public Long id;
    ...
    //Relazioni
    public User user;
    public Place place;
        ...
    public Event(User user, Place place,String nome, String descrizione, String uRLImmagine, Date dataInizio, Long durata, Boolean isRicorrente, Long ricorrenza) {
        this.user=user;
        this.place=place;
        ...
    }
        ...
}
このようにEventクラスを変更すると
public class Event extends Model{
    @Id
    public Long id;
    ...
    //Relazioni
    public User user;
    //public Place place;
        ...
    public Event(User user, Place place,String nome, String descrizione, String uRLImmagine, Date dataInizio, Long durata, Boolean isRicorrente, Long ricorrenza) {
        this.user=user;
        //this.place=place;
        ...
    }
        ...
}
上記の同じコードは、1つのイベントを含むリストを返します(私が期待したもの)
編集:これはPlaceクラスです
public class Place extends Model {
@Id
public Long id;
public String nome;
public String descrizione;
public String uRLImmagine;
public String indirizzo;
//Relazioni
// public User user;
//@Filter("place")
//public Query<Event> events;
private Set<Long> idEvents = new HashSet<Long>();
private Set<Long> idPlaceVotes = new HashSet<Long>();
private Set<Long> idPlaceComments = new HashSet<Long>();
public Place(/*User user,*/ String nome, String descrizione, String uRLImmagine,String indirizzo) {
//  this.user=user;
    this.nome = nome;
    this.descrizione = descrizione;
    this.uRLImmagine = uRLImmagine;
    this.indirizzo = indirizzo;
}
static Query<Place> all() {
    return Model.all(Place.class);
}
public static Place findById(Long id) {
    return all().filter("id", id).get();
}
public String toString() {
    return nome;
}  
public static void delete(Long id) {
    findById(id).delete();
}
}
これはUserクラスです
public class User extends Model {
@Id
public Long id;
public String nome;
public String email;
public String webId;    //ID of the user in the provider website
public String passwordHash;
public String service;
//Relazioni
@Filter("user")
public Query<Event> events;
public User(String email, String name,String webId, String passwordHash, String service) throws Exception {
    if (email!=null)
        this.email=email;
    else
        throw new Exception("An email is required");
    if (name!=null)
        this.nome=name;
    else
        throw new Exception("A name is required");
    if (webId!=null)
        this.webId=webId;
    else
        throw new Exception("A webId is required");
    this.passwordHash=passwordHash;
    this.service = service;
}
public void setEmail(String email) throws Exception{
    if (email!=null)
        this.email=email;
    else
        throw new Exception("An email is needed");
}
static Query<User> all() {
    return Model.all(User.class);
}
public static User findById(Long id) {
    return all().filter("id", id).get();
}
public static User findByEmail(String email){
    return all().filter("email", email).get();
}
public String toString() {
    return nome;
}
}
MyModelはsiena.Modelのスーパークラスでしたが、何の役にも立たないことを知っているので、Modelに戻しました。私はplay1.1でplay-siena1.5を使用しています