Hi guys, I am new to hibernate. I have a situation in which I need to query on the property of a set which itself is a property of an object. eg :
Class Offer {
String offerId;
@ManyToMany private Set<Product> products = new HashSet<Product>(); @ManyToMany private Set<Store> stores = new HashSet<Store>(); }
And I need to query now on the basis of productId which is in Product and storeId which is inside store. I need to get all offers which is belonging to a particular store and a particular product.
The query I used was @NamedQuery(name="SaleOffer.byOfferIdAndStoreId", query = "from Offer where products.productId = ? and stores.storeName = ?") But this did not work. How do I do the query in this case. TIA
Anand
|