-->
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.  [ 2 posts ] 
Author Message
 Post subject: Query by criteria - item must belong to multiple category
PostPosted: Thu Aug 25, 2011 5:18 pm 
Newbie

Joined: Sun Aug 21, 2011 11:40 am
Posts: 9
Hi,
i have a followed many to many (example) association:

---------------- --------------------------- ----------------------
| ITEM | | ITEM_CATEGORY | | CATEGORY |
---------------- -------------------------- ----------------------
| item nb. 1 | | item nb.1 / cat nb.1 | | category nb. 1 |
---------------- -------------------------- -----------------------
| item nb. 2 | | item nb.1 / cat nb. 2 | | category nb. 2 |
---------------- --------------------------- ----------------------
| item nb. 3 | .............
----------------

I wont retrive items which belong do category nb.1 AND category nb.2

If i have criteria:

Criteria crit = sess.createCriteria(ITEM.class);
crit.createAlias("categories", "cat");

so i have above drawn situation.

If item have to belong to cat1 or cat2 everyting is easy: i use Disjunction
But in my situation i can't use Conjunction (or a few restrctions) beacouse this is not what I mean

Thank for any tips


Top
 Profile  
 
 Post subject: Re: Query by criteria - item must belong to multiple category
PostPosted: Fri Aug 26, 2011 9:51 am 
Newbie

Joined: Sun Aug 21, 2011 11:40 am
Posts: 9
any idea?


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

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.