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

Generator support for generic list/set bindings to array fields #1784

Closed
alexcase52 opened this issue Nov 10, 2020 · 4 comments · Fixed by #1788
Closed

Generator support for generic list/set bindings to array fields #1784

alexcase52 opened this issue Nov 10, 2020 · 4 comments · Fixed by #1788
Labels

Comments

@alexcase52
Copy link

alexcase52 commented Nov 10, 2020

I have pojo like

class SomePojo {
   Long id;
   List<String> field;
}

the field is mapped into array column in DB.
I have

AppDao {
 @SqlUpdate
   void create(@BindFields SomePojo pojo)
}

This is working fine when I use proxy-based SqlObjects. But when I switched to generator, I got errors like:
No argument factory registered for type [java.util.List] for element [field] on [SomePojo@dd568eb] [statement:"INSERT INTO some_pojo(id, field) values (id, :field)", arguments:{positional:{}, named:{}, finder:[{lazy bean field arguments "SomePojo@dd568eb"]}]

I can workaround this by changing pojo to:

class SomePojo {
   Long id;
   String[] field;
}

but this produces some boilerplate to convert then into Set<String> or List<String>

jdbi3-generator 3.17.0

@stevenschlansker
Copy link
Member

Thank you for reporting this, I'm excited someone is actually using the generator!

@stevenschlansker
Copy link
Member

Hi @alexcase52 , if you have time could you test and see if #1788 fixes your problem?

@stevenschlansker
Copy link
Member

Also note that you'll need to have String registered as an array type, the H2DatabasePlugin and PostgresPlugin do this for you, or you can call registerArrayType yourself.

@stevenschlansker
Copy link
Member

Fixed in 3.18.0

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

Successfully merging a pull request may close this issue.

2 participants