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