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.  [ 4 posts ] 
Author Message
 Post subject: need help with hbm query
PostPosted: Tue Feb 16, 2010 9:31 pm 
Newbie

Joined: Thu Mar 26, 2009 8:50 pm
Posts: 5
I am trying to duplicate this query

Select *
ValueA = ( Select sum(Value) from Table C Where EventId = a.EventId )
FROM TableA a

I'm having a really hard time with this

<query name="Get.All.EventData">
<![CDATA[ Select *,
EventSum = ( Select sum(Value) from Events p Where e.EventId = p.EventId )
from Employee e ]]>
</query>

But this doesn't work. Can anyone help me with this? It's really important

Thanks,
Nick


Top
 Profile  
 
 Post subject: Re: need help with hbm query
PostPosted: Wed Feb 17, 2010 4:58 am 
Newbie

Joined: Thu Feb 11, 2010 2:05 pm
Posts: 4
Location: Ghent, Belgium
Could you put some log lines of the hibernate error?
It seems that you are using a SQL query where hibernate expects a HQL query...


Top
 Profile  
 
 Post subject: Re: need help with hbm query
PostPosted: Wed Feb 17, 2010 9:04 am 
Newbie

Joined: Thu Mar 26, 2009 8:50 pm
Posts: 5
yeah my sub query is incorrectly written. There's not really a log line. I just dont know how to write a line where I'm going to get a value from an individual query

This line:
ValueA = ( Select sum(Value) from Table C Where EventId = a.EventId )

Where I would query a value based on the current tables value

Table A
EventId
Name
.....

TableC
TableCId
EventId
Name
.....

I'm just confused how I would write that in an hbm query.


Top
 Profile  
 
 Post subject: Re: need help with hbm query
PostPosted: Sun Feb 21, 2010 1:08 am 
Newbie

Joined: Thu Mar 26, 2009 8:50 pm
Posts: 5
bump


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