-->
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.  [ 5 posts ] 
Author Message
 Post subject: Combining Query by Criteria and Quer by example
PostPosted: Wed May 26, 2004 1:43 am 
Regular
Regular

Joined: Tue Mar 23, 2004 2:10 am
Posts: 51
Hi,
I am working on an application where most of the queries are complex and there where clause is dynamic based on the the search criteria. Some queries only involve equal comparison and i used query by example in that cases but in most of other cases other operators (>,<,Or,and) are used. In the second case i have to make a dynamic query myself by checking null in search critera and appending not null to my where clause. What i intend to ask is ,Can query by criteria and query by example can be used together. So i specify the operators using Expression API and queruy is build dynamically by using Example object?

Please help me asap

Regards,
Shoaib Akhtar


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 5:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
http://www.hibernate.org/hib_docs/reference/en/html/querycriteria.html#querycriteria-examples


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:18 am 
Regular
Regular

Joined: Tue Mar 23, 2004 2:10 am
Posts: 51
Hello,
Thanks michael for your answer, but probably you dont get my question right. I have read the documentation already. What i am asking is that can i use expressions and example at the same time for one query.Mean to say that i give an expression telling that where to use which operator and also give an Example. So that i tell that betwwen the two properties use between for some other i specify equality and for other > and give it an example so that hibernate makes dynamic where clause ignoring the criteria for null values.
Or is there is any way to tell Expression or Criteria APi to ignore null values in query.

Regards,
Shoaib Akhtar


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yes, you can. Why not just try it out?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 1:29 am 
Regular
Regular

Joined: Tue Mar 23, 2004 2:10 am
Posts: 51
Hello,
Thanks michael for your answer, but probably you dont get my question right. I have read the documentation already. What i am asking is that can i use expressions and example at the same time for one query.Mean to say that i give an expression telling that where to use which operator and also give an Example. So that i tell that betwwen the two properties use between for some other i specify equality and for other > and give it an example so that hibernate makes dynamic where clause ignoring the criteria for null values.
Or is there is any way to tell Expression or Criteria APi to ignore null values in query.

Regards,
Shoaib Akhtar


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