I'm trying to migrate old code that uses JPA 1.0 and Hibernate 3.3 (yes, it's really old) to a different (non-SQL) data API. One of the queries looks something like this:
SELECT tx.transactionId, MAX(tx), SUM(tx.amount)
FROM Transaction tx
WHERE tx.customerId = :customerId
AND ... // etc
GROUP BY tx.transactionId
My question: What should the result of MAX(tx)
be? All of the documentation I've seen claims that MAX
is only valid for comparable scalar values (numbers, strings, dates), not entity references. From context, the query in fact returns instances of Transaction
, but I can't tell what those instance are (specific persisted entities? composite entities of some kind?) or how they relate to the grouped result sets.
Is this some Hibernate extension to the spec? I couldn't find anything in the Hibernate docs either, and I wasn't able to locate the code in the Hibernate sources that deals with that specific behavior. I actually don't care either way (since I have to rewrite the entire call in a different manner anyway), I just would like to know what the replacement should do.
Anybody recognize this?