-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: query on the property of a map which itself is a property
PostPosted: Mon Mar 04, 2013 5:58 am 
Newbie

Joined: Mon Mar 04, 2013 5:47 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.