[jboss-user] [Installation, Configuration & DEPLOYMENT] - multiple or with hibernate criteria
rizqureshi2
do-not-reply at jboss.com
Tue Jun 23 22:30:16 EDT 2009
Anyone has come across the problem where you need to define multiple or statement in a hibernate criteria. Consider the following code segment:
| Criteria crit = session.createCriteria(Project.class);
| Criteria jobs = crit.createCriteria("jobTypes");
| jobs.add(Restrictions.or(Restrictions.eq("id", 1),
| Restrictions.or(Restrictions.eq("id", 2),
| Restrictions.or(Restrictions.eq("id", 3),
| Restrictions.or(Restrictions.eq("id", 4),Restrictions.eq("id", 5))
| ))));
|
Now, how would one create such a nested OR cirterion using for/while loop if one has any number of different ids {1,2,3,4,5,6.....}?
Thanks,
Rizwan
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239585#4239585
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239585
More information about the jboss-user
mailing list