在 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);
最佳答案
你需要这样做:
String q="find * fetch sections where sections.id is null"
Ebean.createQuery(User.class,q).findList();
这将创建一个左外连接查询,find.where().IsNull("sections") 不起作用。
关于java - ManyToMany 为空的 Ebean Search?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13799436/