-->
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: HQL equivalent of SELECT CASE WHEN <blah> THEN 1 ELSE
PostPosted: Tue Apr 03, 2007 11:52 am 
Newbie

Joined: Tue Apr 03, 2007 11:37 am
Posts: 1
Is there any way of writing an HQL query which achieves the equivalent of this in SQL:

SELECT CASE WHEN EXISTS (SELECT FROM Foo WHERE <clause>) THEN 1 ELSE 0 END


I can work around this for the moment by using:

select count(f) from Foo f where <clause>

...and checking if this result is >0, but I'm not interested in knowing the actual number of matching rows, and the RDBMS could get better performance out of my preferred approach - if I could express it in HQL.


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.