-->
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: How to specify and condition using query by Example?
PostPosted: Fri Apr 07, 2006 6:01 am 
Beginner
Beginner

Joined: Mon Nov 28, 2005 11:03 am
Posts: 39
Location: Madrid
Dear members,

We have detected that when we use for example a query like this:

Code:
Cat cat = new Cat();
cat.setSex('F');
cat.setColor(Color.BLACK);
List results = session.createCriteria(Cat.class)
    .add( Example.create(cat) )
    .list();

we get on the result a "OR" condition, so we would get all the cats that are Female or Black. On the Reference Manual there is no more additional information about how it is solved:

http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#querycriteria-examples

Do you have any idea how to impose we want a AND condition, that is all cats that are females and black too?

Thanks in advance,

David

_________________
David Leal


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.