Select an entity according to a list of associated entities
- by Maverickch
I have the following database schema :
Two tables, books and tags, with n-m relationship.
Books - Tags
We can have for example the book 1, with tags {A,B,C}, and book 2, with tags {A}.
I would like to select the books according to a list of tags.
For example : selected tags list : {A,B}
- book 1
My idea was to use the MINUS SQL function, to subtract book tags list to the selected tags list, and return the book if the list was empty. Unfortunately, this SQL function is not supported by HQL.
Any idea about that ?