-->
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 Example help
PostPosted: Sun Mar 28, 2010 10:31 pm 
Newbie

Joined: Wed Jan 20, 2010 11:12 am
Posts: 15
Hi all,
I am using Query By Example in hibernate, but what i am facing is when Hibernate generates the query then all fields will be checked as "and" operation, while i want to change it to "or" operation.

e.g
Code:
User user = new User()
        user.setUserId(userId);
        Example ex = Example.create(user);
        ex.ignoreCase();
        ex.enableLike(MatchMode.ANYWHERE);
        list = getSession().createCriteria(User.class).add(ex).list();


so after doing this Hibernate is generating query like

... where userID=? and, username=? and, address=? and...

and what i wants to generate a Query like

... where userID=? or, username=? or, address=? or...

So guys can you help me out please


Top
 Profile  
 
 Post subject: Re: Query By Example help
PostPosted: Mon Mar 29, 2010 12:04 pm 
Newbie

Joined: Wed Jan 20, 2010 11:12 am
Posts: 15
Any Help please?


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.