-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate PL/SQL
PostPosted: Tue Mar 02, 2010 9:37 am 
Newbie

Joined: Tue Mar 02, 2010 9:33 am
Posts: 1
Could someone please give me a hibernate statement that contains a PL/SQL statement that stops counting records if one is found?
i.e.
int i = 0;
count records;
if i++, stop counting;
return boolean

Thanks. I've been wracking my brains all day and time is short. I would really appreciate the help.


Top
 Profile  
 
 Post subject: Re: Hibernate PL/SQL
PostPosted: Wed Mar 03, 2010 11:43 am 
Beginner
Beginner

Joined: Tue Aug 25, 2009 11:42 am
Posts: 49
I am wondering why u'd need something like that? A database count(*) operation should usually not take much time. It it's only the return value that u want to be a Boolean instead of a number and u want to do that in the HQL instead of Java code:
SELECT CASE count(a) WHEN 1 THEN true ELSE false END FROM A a


Top
 Profile  
 
 Post subject: Re: Hibernate PL/SQL
PostPosted: Wed Mar 03, 2010 11:46 am 
Beginner
Beginner

Joined: Tue Aug 25, 2009 11:42 am
Posts: 49
And in case u want it to be part of the where clause of any other HQL,
.... where exists(from A)


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