-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to ingore null value when using Criteria?
PostPosted: Mon Dec 29, 2003 10:00 pm 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
I used Criteria to select record. I hope h2 ingore this condition when argument is null.
e.g.
crit.add(Expression.ge("inputDate", model.getSearchBeginDate()));
if model.getSearchBeginDate() == null, I hope h2 ingore this condition.
How can I config it or I should judge null value by myself?

By the way sometime when I update record, I also want h2 to remain origin value if new field value is null.
e.g.
session.update(model);
if model.getField1()==null(Field1 is not key), I want remain origin value of this field in database, not set to null.
Can I simply config something to archive it?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 11:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You have to do that manually


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 31, 2003 6:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You can use an Example query perhaps?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 4:40 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Thank you.
I see.


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