Hibernate Criteria query: finding matching records in a ManyToMany relationship
posted 7 years ago
I have a ManyToMany relationship between Content and Keyword entities (one Content instance contains a List of Keyword references). I'd like to find Content instances whose list of Keywords contains one or more of the Keywords in a provided list.
I can accomplish this with the following Criteria query if I provide a list of Keyword IDs rather than Keyword instances. It seems like there should be a way to be able to use the list of Keywords directly rather than have to create a separate list of IDs from it. Can someone please help me out?