-->
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: How to select scalar map value
PostPosted: Fri Mar 30, 2007 4:44 pm 
Newbie

Joined: Thu Mar 15, 2007 2:25 am
Posts: 6
Hi,

I am trying to select the sum of values from the scalar elements of a mapped 'map' collection and cannot get it to work, i've tried all sorts of things and gotten all sorts of errors. Debugging isn't helping much.

Basically I have a Order class, that has a property 'purchases' of type Map<Date, Double>. (dates, prices). The 'purchases' are stored in simple a table with column types 'date' and 'double'.

Using HQL, I would like to select the sum of all the prices that occurred on a certain date, something like:

Code:
SELECT sum(??price??) from Order o join o.purchases WHERE index(o.priceHistory) = '2007-02-02'


where ??price?? is the scalar element of the map (from the 'price' column of the mapped table)

How do I accesss the scalar element of a map collectoin using HQL?

I am using Hibernate 3.

Thanks,
Eric


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.