-->
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: HQL sum() returns null in addition to the sum value
PostPosted: Thu Mar 15, 2012 3:41 pm 
Newbie

Joined: Thu Mar 15, 2012 3:35 pm
Posts: 2
Hi All

I have a hql as "select sum(q.packagePrice) from Quote q"
This hql returns a list that has two elements. The first (list.get(0)) is null. The second (list.get(1)) is the correct value.
Can anybody tell me why I got the null value? The query list is supposed to have a single value right?

Thanks for your help.

Leaf


Top
 Profile  
 
 Post subject: Re: HQL sum() returns null in addition to the sum value
PostPosted: Mon Mar 19, 2012 10:11 am 
Newbie

Joined: Thu Mar 15, 2012 3:35 pm
Posts: 2
Got the reason. The Quote class a child class RQuote. So the hql is run on both the parent and child objects. There is no relationship defined in Quote.hbm.xml or RQuote.hbm.xml. Just RQuote.java is defined as extends Quote. The default lazy fetching is used. Anybody knows how to prevent the child object being queried? Thanks


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.