-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HHH-15618 Accept TypedParameterValue for procedure #5438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Could anyone review this? |
I don't see a reason for this PR. There is an explicit API that can be used to bind parameters in a typed fashion. Also, |
@beikov Updated as you suggested. |
Adopting Hibernate's With @quaff having offered a patch in the location your cited, what are the odds you could merge this patch? |
Hibernate supports TypedParameterValue in queries, but not stored procedures. Until hibernate/hibernate-orm#5438 is adopted, we have to dereference such parameters on our end first. Closes #2544.
Hibernate supports TypedParameterValue in queries, but not stored procedures. Until hibernate/hibernate-orm#5438 is adopted, we have to dereference such parameters on our end first. Closes #2544.
Hibernate supports TypedParameterValue in queries, but not stored procedures. Until hibernate/hibernate-orm#5438 is adopted, we have to dereference such parameters on our end first. Closes #2544.
Regarding Hibernate 6.1, it appears to already be handled way up the hierarchy in @Override
public CommonQueryContract setParameter(int position, Object value) {
if ( value instanceof TypedParameterValue ) {
@SuppressWarnings("unchecked")
final TypedParameterValue<Object> typedValue = (TypedParameterValue<Object>) value;
final BindableType<Object> type = typedValue.getType();
if ( type != null ) {
return setParameter( position, typedValue.getValue(), type );
}
else {
return setParameter( position, typedValue.getValue(), typedValue.getTypeReference() );
}
}
final QueryParameterImplementor<?> param = getParameterMetadata().getQueryParameter( position );
if ( param == null ) {
throw new IllegalArgumentException( "Positional parameter [" + position + "] is not registered with this procedure call" );
}
if ( param.allowsMultiValuedBinding() ) {
final BindableType<?> hibernateType = param.getHibernateType();
if ( hibernateType == null || isInstance( hibernateType, value ) ) {
if ( value instanceof Collection && !isRegisteredAsBasicType( value.getClass() ) ) {
//noinspection rawtypes,unchecked
return setParameterList( param, (Collection) value );
}
}
}
locateBinding( position ).setBindValue( value, resolveJdbcParameterTypeIfNecessary() );
return this;
} |
Hibernate 6.1 properly handles TypeParameterValue for general parameters, but not for temporal ones. So we must dereference in those scenarios. Related: #2544, hibernate/hibernate-orm#5438
Hibernate 6.1 properly handles TypeParameterValue for general parameters, but not for temporal ones. So we must dereference in those scenarios. Related: #2544, hibernate/hibernate-orm#5438
Hibernate 6.1 properly handles TypeParameterValue for general parameters, but not for temporal ones. So we must dereference in those scenarios. Related: #2544, hibernate/hibernate-orm#5438
Main branch(v6) doesn't need change if I understand correctly as @gregturn
said.
Christian Beikov ***@***.***> 于2022年12月21日周三 06:06写道:
… Updated as you suggested.
@quaff <https://github.com/quaff> the changes look good, but please also
create a PR against the main branch. Chances are good that we will merge
this also for 5.6 @gregturn <https://github.com/gregturn>
—
Reply to this email directly, view it on GitHub
<#5438 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABC5QALLZEVI2YRCXBWGWTWOIUVNANCNFSM6AAAAAARK6W3UI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
But it needs at least a test case to verify it works correctly. |
Thanks! |
Hibernate resolved hibernate/hibernate-orm#5438, allowing us to no longer implement special handling. Resolves #2902.
Hibernate resolved hibernate/hibernate-orm#5438, allowing us to no longer implement special handling. Closes #2902 Original pull request #2933
Hibernate 6.1 properly handles TypeParameterValue for general parameters, but not for temporal ones. So we must dereference in those scenarios. Related: #2544, hibernate/hibernate-orm#5438
Fix spring-projects/spring-data-jpa#2544