GitHub Immutables and SnakeCase Columns

113 views
Skip to first unread message

rob...@bright.md

unread,
Nov 7, 2018, 8:05:41 PM11/7/18
to jDBI
Is there a simple way to map from a result set with snake case columns to an Immutable? I'm new to JDBI and I think the approaches I've taken haven't been stellar. I was hoping I could do a Jackson convert on a mapToMap result, but the Immutable expects camel case on the database uses snake case for the fields. Jackson doesn't seem to use my mappers. I don't mind writing a custom mapper if I have to but all the `rs.getString/getTimestamp(name)` type calls get a little tedious. Thanks!

Matthew Hall

unread,
Nov 28, 2018, 12:53:36 PM11/28/18
to jd...@googlegroups.com
Take a look at Have a look at https://github.com/jdbi/jdbi/pull/1282. We are working toward basic support for mapping and binding @Value.Immutable and @Value.Mutable types.

At this point, "simple" means no support for any configuration beyond the above annotations. Immutables annotations are not retained at runtime, so we have to runtime reflection on method names to make this work :-/

-Matthew

On Wed, Nov 7, 2018 at 6:05 PM <rob...@bright.md> wrote:
Is there a simple way to map from a result set with snake case columns to an Immutable? I'm new to JDBI and I think the approaches I've taken haven't been stellar. I was hoping I could do a Jackson convert on a mapToMap result, but the Immutable expects camel case on the database uses snake case for the fields. Jackson doesn't seem to use my mappers. I don't mind writing a custom mapper if I have to but all the `rs.getString/getTimestamp(name)` type calls get a little tedious. Thanks!

--
You received this message because you are subscribed to the Google Groups "jDBI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jdbi+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages