I have the following structure:
Product.Java :
String name
@OneToMany(mappedBy="product")
private List<ProductServingTimeAvailablity> servingTimeAvailablities;
@OneToMany(mappedBy="product")
private List<ProductStyles> styles;
@OneToMany(mappedBy="product")
private List<ProductLocationAvailability> locationAvailabilites;
I need to retrieve all the products where
- product.servingTimeAvailablities contains 1 and
- product.styles contains 2 and
- product.locationAvailabilites contains 3
(meaning - each product can have many time availability and many styles and many locations and I need to choose only the products that are available at time 1, are style 2 and are available for location 3)
How can I do it in HQL?
It's not in but contains.