Skip to content

Bind arrays in Sql Objects queries #2454

Answered by stevenschlansker
fedxyz asked this question in Q&A
Discussion options

You must be logged in to vote

@Bind is used to change the name of the parameter binding. If the method parameter names are present (non-default compiler configuration), then @Bind is optional. See: https://jdbi.org/#compiling_with_parameter_names

With the Postgres plugin installed, any scalar type that the server supports arrays of should be supported. Enums (Test[]), primitives (long[]), and boxed (Long[]) should all work.

When writing DAO code, I would encourage you to write test cases that cover your usage of Jdbi. For example, a unit test for your DAO interface would check that enums can be read and written, and that Longs are stored. That checks that you are invoking Jdbi in a way that you get the results you exp…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fedxyz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants