I have a Category class which looks like this:
@Entity
@Table(name = "categories")
public class Category implements Serializable {
// other attributes
@ManyToMany
@JoinTable(name = "articlecat",
joinColumns = {@JoinColumn(name = "categoryId")},
inverseJoinColumns = {@JoinColumn(name = "articleId")})
private List<Article> articleList;
// other methods
}
How can I query Categories using a single Article, something like this:
SELECT c FROM Category c WHERE c.articleList contains :article
You can use MEMBER OF (OF is optional).