Reputation: 846
I have an Entity called ArtWork and the Entity has attribute List<Style>
styles, the list may have n number of styles.
Style has attribute called title
I require a Hibernate query that returns all artworks which has a style title="Abstract"
-Thanks for your help
Upvotes: 0
Views: 1607
Reputation: 14363
Single title:
select a from ArtWork a inner join a.styles style where style.title = 'Abstract'
Multiple titles:
Provide a named parameter list.
List<String> titles = ... // Your titles
session.createQuery("from ArtWork a inner join a.styles style where style.title in (:titles)").setParameterList("titles", titles);
Upvotes: 1