I need assistance with a tricky hibernate query problem. I have the following entities:
public class Book {
private String bookId;
private String autho
I would advice you to create two custom functions or restriction as :
collect(book.tags) -> returns list of tags associated with the book
containsAll(bookTagsList, tags) --> validates and returns true if all
tags elements are present in bookTagsList
returned by the first function "collect"
Once functions are defined and registered, you would be able to run HQL/criteria query like:
from Book book where containsAll(collect(book.tags), :tags)
or
session.createCriteria(Book.class).add(
Restrictions.add(collect("tags").containsAll(tags))
).list();
Please Note: This is just a sample pseudo code to share the idea.
Hope this helps!