views:

24

answers:

1

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.springframework.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.

+2  A: 

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'
Pascal Thivent