Reputation: 1902
Simplified:
Class1 {
private Collection<Class2> items;
}
Class2 {
private String name;
}
Now I want to be able to retrieve all Class1
objects that have a Class2
object in items
where name
is like
for example 'abc';
I think I have to use the elements()
function in HQL, but not sure yet how to use the property values.
Any pointers are welcome!
Upvotes: 1
Views: 1531
Reputation: 691645
No, you just need to make a join:
select c1 from Class1 c1 inner join c1.items c2 where c2.name = 'abc'
Read the Hibernate documentation on HQL, associations and joins.
Upvotes: 3