I have a composite user type that represents a monetary amount. This type spans to two columns.
-Amount
-Currency
When i am creating an HQL query that performs an aggregate function like “avg” on a property using this composite user type an exception is thrown. The reason as it seems is that AvgFunction cannot operate with types that have multiple columns.
Is there any way to use CompositeUserType in aggregate functions?
Thanks in advance and best regards
Stathis Alexopoulos
Your query doesn’t make much sense. What would be the average of these three rows?
You may average the amounts and neglect the currency:
but you can’t average the monetary amounts (i.e. the tuple [amount, currency]).