Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16986 (
https://hibernate.atlassian.net/browse/HHH-16986?atlOrigin=eyJpIjoiNGRmND...
)
Re: CoercionException caused by attempted coercion of query param to entity field type (
https://hibernate.atlassian.net/browse/HHH-16986?atlOrigin=eyJpIjoiNGRmND...
)
For example passing 2.5d and 2f to a calculation expected to return Integer
seems fine to me, and I would expect the result of (int) (2.5d * 2f) to be
5.
This is OK as you’ve written it, because the narrowing type conversion is explicit. But
that’s not the case in the examples we’re considering.
For example, Java doesn’t let you write:
int i = 2.5d * 2f;
And quite rightly so.
Your example of ?1 * ?2 is actually the exceptional case because here both sides of the
numeric operator have unknown types, so no type can be inferred.
(
https://hibernate.atlassian.net/browse/HHH-16986#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16986#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:f5b6255 )