-->
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: SQL ISNULL equivalent in Criteria Queries?
PostPosted: Fri Sep 19, 2008 2:20 pm 
Newbie

Joined: Thu Aug 24, 2006 2:49 pm
Posts: 3
I've looked everywhere for documentation or others that have done this but I can't find anything. There is Expression.IsNull(fieldName) which does the equivalent of a normal SQL ISNULL(fieldName) but what I need is ISNULL(fieldName, useThisValueIfNull). Expression.IsNull only allows for one argument.

For example, say I want to order a list by date in descending order, but have null dates to be ordered as if they were put in today:
SQL:
Code:
SELECT * FROM myExample ORDER BY ISNULL(myDate, getdate()) DESC


How can I do this with Criteria Queries?


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.