Skip to content

Conversation

@mbellade
Copy link
Member

@mbellade mbellade commented Nov 6, 2025

https://hibernate.atlassian.net/browse/HHH-19906


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


//noinspection unchecked
final JavaType<Object> elementJavaType = ((BasicPluralJavaType<Object>) basicType.getJdbcJavaType()).getElementJavaType();
final var elementJdbcType = ((ArrayJdbcType) basicType.getJdbcType()).getElementJdbcType();
final Object domainArray = basicType.convertToRelationalValue( value );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can keep on relying on Object[] and hence keep all the code as it is. You just have to use basicType.getJavaType().unwrap( value, Object[].class, options ) here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I intuitively did initially as well, but then I realized that unwrap would cause additional array instantiations and/or iterations of the values in case the original type is not exactly Object[] so I went this route.

We could still use that as a fall-back, though I don't think there are cases where the value is not either an array or an instance of java.util.Collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants