2

PlayFrameworkを使用して、モデルに関連付けられているManyToManyアイテムがないすべてのアイテムを一覧表示しようとしていますが、どうすればよいですか?

これが私の構造です:

User
    @ManyToMany
    List<Section> sections;

    public static Model.Finder<Long,User> find = new Model.Finder<Long, User>(Long.class, User.class);

Section
    Integer year;
    @ManyToMany
    List<User> users;

    public static Model.Finder<Long,Section> find = new Model.Finder<Long, Section>(Long.class, Section.class);
4

2 に答える 2

4

これを行う必要があります:

String q="find * fetch sections where sections.id is null"

Ebean.createQuery(User.class,q).findList();

これにより、左外部結合クエリが作成され、find.where()。IsNull( "sections")は機能しません。

于 2013-06-14T18:45:24.613 に答える
2

これらを試してください:

find.where().eq("sections", null).findList();

また

find.where().isNull("sections").findList();

申し訳ありませんが、頭のてっぺんからです。今は確認できません。

于 2012-12-10T11:10:14.747 に答える