Skip to content
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

Add array support #863

Open
minborg opened this issue Feb 19, 2020 · 0 comments
Open

Add array support #863

minborg opened this issue Feb 19, 2020 · 0 comments
Milestone

Comments

@minborg
Copy link
Contributor

minborg commented Feb 19, 2020

Running into an issue where Speedment is mapping text[] to java.lang.String. Wondering if this is known and expected that I should write my own mapper, or a defect I should raise.

It is indeed from postgres, any type can be made into an Array. In this case I think String[] makes the most sense since you can't use a Collection or else it'll erase the generic type parameter. My attempt at a custom mapper was fruitless however, as I discovered there isn't support for Array types in the way Speedment internally builds up the prepared statement with repeated calls to ps.setObject(...), whereas for Array types you would need to explicitly create the java.sql.Array like conn.createArrayOf(...) and set it with ps.setArray(...).
Also found a small bug in how it generates code for Array types (not surprising given the lack of support) where generated classes use reference equality instead of Arrays.equals(...), similarly for hashCode.

@minborg minborg added this to the Future milestone Feb 19, 2020
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

No branches or pull requests

1 participant