Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMmRlZDBiMWEz...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-16954?atlOrigin=eyJpIjoiMmRlZD...
) HHH-16954 (
https://hibernate.atlassian.net/browse/HHH-16954?atlOrigin=eyJpIjoiMmRlZD...
) replace use of 'CriteriaBuilder.parameter(List.class)' with something more
typesafe (
https://hibernate.atlassian.net/browse/HHH-16954?atlOrigin=eyJpIjoiMmRlZD...
)
Change By: Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Currently we let you bind a list of values to a criteria query parameter by using
something like:
{ noformat code:java }ParameterExpression<List> inClauseParams = cb.parameter(
List.class, "ids" );{ noformat code }
Unfortunately this isn’t properly type-safe, and righty results in a compiler warning.
One of the tests does this instead:
{code:java}JpaParameterExpression<List<Integer>> param = cb.parameter(
(Class<List<Integer>>) (Class<?>) List.class );{code}
But that ugliness is actually no better, it’s an unchecked cast, which again results in a
compiler warning.
I also noticed that the implementation of this,
{{SqmCriteriaNodeBuilder.MultiValueParameterType}} requires special-case handling in the
HQL type-checking code, which is pretty nasty.
Now, JPA does not require this, and from the git history it appears that we only
implemented in H6 in order to support integration with Search which must use this.
I propose that we replace this with something better, in {{HibernateCriteriaBuilder}}:
{code:java}<T> JpaParameterExpression<List<T>>
parameterList(Class<T> paramClass);
<T> JpaParameterExpression<List<T>> parameterList(Class<T>
paramClass, String name);{code}
and figure out a way to migrate people away from the use of the raw type.
(
https://hibernate.atlassian.net/browse/HHH-16954#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16954#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#100232- sha1:304e1c7 )