我拥有三个模型的保密数据库:
Article - which has is part of multiple categories (EDIT).
Category - which contains articles, and is part of an App
App - which has different categories
I want to select all articles which have a category of a specific app. So I am trying to create something like:
find("ANY categories.app = ?", app).fetch();
与此类似,我与核心援助公司合作,但显然与联合援助机构不合作,我似乎无法找到如何做到这一点。
Edit: To clarify: in Articles:
@ManyToMany
public List<Category> categories;
类别:
@ManyToOne
public App app;
@ManyToMany(mappedBy = "categories")
public List<Article> articles;
适用:
@OneToMany(mappedBy = "app")
public List<Category> categories;