我有两个数据库表,都使用 Hibernate 映射。第一个表有一个带有一个字段的主键。第二个具有包含三个字段的复合主键。假设我尝试通过仅提供部分键(一个字段)来从第二个表中获取结果,然后我会得到一个异常
线程“main”org.springframework.orm.hibernate3.HibernateSystemException中出现异常:找到了多个具有给定标识符的行
知道如何使用提供给方法的部分键来获取多行吗?
感谢您的帮助。
最佳答案
Any idea how I can get multiple rows with the partial key provided to a method?
像这样的东西会起作用:
select foo from Foo foo where foo.id.field1 = 'bar'
关于java - 带部分键的 Hibernate 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3206631/