-->
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: Restrictions
PostPosted: Mon Aug 09, 2010 10:40 am 
Newbie

Joined: Mon Aug 09, 2010 10:20 am
Posts: 1
Hi, I've been banging my head against the wall for a while so here goes..(class names changed to protect the innocent)
I have 3 classes Employer, Employee, Manager.
Each Employer has one or more Employees, each Employee has 2 Managers (districtManager and areaManager) I want to do a search for
based on the name of the districtManager or areaManagers name. So I have..

Criteria c = getCurrentSession().createCriteria(Employer .class);
c.createCriteria("employee");
//this where is starts to blur I want to add a Restriction that is the equivalent to...
// where districtManager.name like '%blah% or areaManager.name like '%blah%';

//I can do
c.createCriteria("employee").createCriteria("districtManager).add(Restrictions.like("name",blah);
// and
c.createCriteria("employee").createCriteria("areaManager).add(Restrictions.like("name",blah);

//BUT what I ( think) I want to do is make a disjunction of the 2 Criteria(districtManager and areaManager) . How can I do that?


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.