-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with Hibernate Criteria Query
PostPosted: Mon Aug 21, 2006 11:24 am 
Newbie

Joined: Tue Jul 26, 2005 10:25 am
Posts: 12
I am trying to return a collection of "User" objects using the following function:

Code:
   public Collection loadDistinctByOrganizationAndRoles(Organization organization, Collection roles) {
        Criteria criteria = getSession().createCriteria(User.class);
        criteria.add(Expression.eq("assignedOrganization", organization));
        criteria.add(Expression.in("roles", roles));
        return criteria.list();

}


My question: is Expression.in() capable of iterating over the roles collection, or will I have to write the iteration myself to keep adding "ors" to the criteria?

Hibernate version is 3.1.3.

Jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 11:37 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
should be able to use the Collection if the values are sensible

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 12:46 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
I've used Expression.in() with over 800 elements in the collection and it worked fine.

Curtis

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.