ITeye博客

hibernate hql(多对多 子查询)

wanglei0119 · 2010-03-03 16:29 · hibernate · 企业架构 · Markdown

现在有两张表,文章(Article) 和 目录(Category).

找出某些个目录中的所有文章的hql:

from Article as a left join a.categories as c where c.id in(:ids)

找出某些目录中但不属于指定目录(id=xxx)的hql: from Article a where a in (select elements(c.articles) from Category c where c.id in (:ids)) and a not in (select elements(c.articles) from Category c where c.id = xxx)

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。