我有两个表(Author和Publicaction)。这些都与Hibernate自动生成的多对多表(写入)相连接。现在我想有一个这样的查询:
SELECT * from Publication p, Writes w
WHERE w.authorId = ?;应该运行此查询的方法将Author-table中的Id作为输入。
我如何在hql中做到这一点?
谢谢!!
发布于 2012-12-07 21:40:44
select p from Publication p
inner join p.authors author
where author.id = :authorId通过阅读the documentation了解HQL和joins。
https://stackoverflow.com/questions/13764193
复制相似问题