-->
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.  [ 2 posts ] 
Author Message
 Post subject: coalesce() and ArrayIndexOutOfBoundsException
PostPosted: Thu Jan 10, 2008 6:37 am 
Newbie

Joined: Thu Jan 10, 2008 6:12 am
Posts: 3
Hi experts,

How do I use coalesce?

This is my HQL query:

Code:
select distinct pay.id as paymentId
,(pay.amount - coalesce((select sum(payDebt.amount) from PaymentDebt payDebt),0))    as amountR
from  Payment pay


But when running the code this gives an java.lang.ArrayIndexOutOfBoundsException: -1

I also tried to use nvl.

Code:
select distinct pay.id as paymentId
,(pay.amount - nvl((select sum(payDebt.amount) from PaymentDebt payDebt),0))    as amountR
from  Payment pay


But hibernate seems to translate this to:
Code:
select distinct payment0_.PAYMENT_ID as col_0_0_, payment0_.AMOUNT-nvl() as col_3_0_
from PAYMENT payment0_


Which results in an ORA-00909 error because the number of arguments of nvl is not correct.

We are using Hibernate 3.2.4.

Lennert


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 10, 2008 9:50 am 
Newbie

Joined: Thu Jan 10, 2008 6:12 am
Posts: 3
Apparently HQL can't handle subqueries in nvl or coalesce.

For more information:
http://forum.hibernate.org/viewtopic.ph ... hlight=nvl


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