Just in case someone needs a code snippet.
This one groups Prices by PriceProvider and was intended to pick only last 5 values for each PriceProvider – but sadly, it’s impossible without window functions. Which are not supported in Hibernate in any way.
def c = Price.createCriteria()
c.list {
priceProvider {
company {
country {
eq('currency.id', 1L)
}
}
}
projection(
groupProperty('id')
)
order('timestamp', 'desc')
}
Post a Comment