开发者

Hibernate query with partial key

I have two database tables, both mapped using Hibernate. The first table has a primary key with one field. The second has a composite primary key with three fields. Suppose I try to fetch results from the second table by providing just the partial key (one field), then I get an exception

Exception in thread "main" org.springfr开发者_JS百科amework.orm.hibernate3.HibernateSystemException: More than one row with the given identifier was found

Any idea how I can get multiple rows with the partial key provided to a method?

Thanks for any help.


Any idea how I can get multiple rows with the partial key provided to a method?

Something like this would work:

select foo from Foo foo where foo.id.field1 = 'bar'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜