Ah, didn’t see your response when I posted my last one 😄 In any case I agree that “would be nice but technically speaking it’s not feasible” is often a reasonable answer to these kinds of problems. The general problem of having any kind of operand in any kind of operation seems hard I agree. And I can understand that you’d prefer not to build a thousand special cases and exceptions, I wouldn’t want to do that either. Mostly it seemed to me that Hibernate basically does parameter resolving and type casting correctly in most other cases and from the outside it’s not obvious that it’s easier for hibernate to identify param types correctly in calculations like ?1 * ?2 than in calculations like test.intField * ?1. Plausibly it is much harder to get the latter right, I don’t know, but I hope you can understand the confusion and why my default expectation was that if the first works then the second should probably work, too. In any case, explicit casting does indeed work, although I’m still figuring out which parts of the query I have to cast explicitly in order for hibernate to deduct all involved operands correctly. |