-
Notifications
You must be signed in to change notification settings - Fork 350
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
ClassCastException on primitive arrays parameters in spring-data-jdbc 2.x.x #945
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Mar 18, 2021
schauder
added
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Mar 22, 2021
schauder
added a commit
that referenced
this issue
Mar 23, 2021
schauder
added a commit
that referenced
this issue
Mar 23, 2021
mp911de
added a commit
that referenced
this issue
Mar 29, 2021
Refactor ArrayUtil into a proper utility class providing toPrimitive and toObject methods for each primitive type. Add boolean support. Move convertToObjectArray to BasicJdbcConverter as its placement in ArrayUtils creates a certain amount of ambiguity over its actual purpose. Create unit test. See #945 Original pull request: #949.
mp911de
added a commit
that referenced
this issue
Mar 29, 2021
Refactor ArrayUtil into a proper utility class providing toPrimitive and toObject methods for each primitive type. Add boolean support. Move convertToObjectArray to BasicJdbcConverter as its placement in ArrayUtils creates a certain amount of ambiguity over its actual purpose. Create unit test. See #945 Original pull request: #949.
mp911de
added a commit
that referenced
this issue
Mar 29, 2021
Refactor ArrayUtil into a proper utility class providing toPrimitive and toObject methods for each primitive type. Add boolean support. Move convertToObjectArray to BasicJdbcConverter as its placement in ArrayUtils creates a certain amount of ambiguity over its actual purpose. Create unit test. See #945 Original pull request: #949.
On a related note, we should consider the conversion of multi-dimensional arrays. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
Using primitive arrays as named parameters causes ClassCastException in spring-data-jdbc-2.x.x
Simple example (PostgreSQL 8.4+):
First method works fine, but second throws ClassCastException when casting int[] to Object[]
in
return JdbcValue.of(typeFactory.createArray((Object[]) convertedValue), JDBCType.ARRAY);
On the other hand, in spring-data-jdbc-1.1.12 both methods work fine.
Tested on spring-data-jdbc-2.1.5 (SB 2.4.3) and spring-data-jdbc-1.1.12 (SB 2.2.13) (Java 8)
Configuration:
The text was updated successfully, but these errors were encountered: