Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16986 (
https://hibernate.atlassian.net/browse/HHH-16986?atlOrigin=eyJpIjoiNzZmZm...
)
Re: CoercionException caused by attempted coercion of query param to entity field type (
https://hibernate.atlassian.net/browse/HHH-16986?atlOrigin=eyJpIjoiNzZmZm...
)
Right, exactly! This case really demonstrates what I’m worried about.
So IMO, this should probably produce an error, since the query does an implicit numeric
type narrowing conversion.
Here, since Hibernate has no information at the time it compiles the query, it skips the
type check, hopes the user knows what they’re doing, and just passes it on to the database
to sort out.
In your case, the database does something pretty bad: truncation.
That’s exactly the sort of thing we want to avoid. This truncation is essentially
“undefined behavior”, something that happens by accident and is not defined in the
semantics of HQL. And it actually destroys information.
So here, IMO, we’re being too permissive. That’s not a good argument for being even more
permissive
(
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 )