Aggregate function on composite user type
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 开发者_Python百科CompositeUserType in aggregate functions?
Thanks in advance and best regards
Stathis AlexopoulosYour query doesn't make much sense. What would be the average of these three rows?
amount currency
5 USD
10 EUR
15 YEN
You may average the amounts and neglect the currency:
select avg(bill.fullAmount.amount) from BillBean as bill
but you can't average the monetary amounts (i.e. the tuple [amount, currency]).
精彩评论