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

How to specify CaseStrategy for MapMapper in SqlObject Extension? #2665

Open
brainbytes42 opened this issue Apr 4, 2024 · 3 comments
Open

Comments

@brainbytes42
Copy link

I have a DAO-interface, which is driven by the SQL Objects-Extension.

For one Method I have this annotations:

@SqlQuery( ... )
@RegisterRowMapper(MapMapper.class)
List<Map<String, Object>> myMethod( ... );

I'd like to have the RowMapper to NOT change the column name's cases, i.e. apply CaseStrategy.NOP.
But how do I make the MapMapper do that?

Thanks!

@ghost
Copy link

ghost commented Apr 4, 2024

You can use MapMappers::setCaseChange(UnaryOperator<String> caseChange) do do this.

See https://jdbi.org/#_configuration

@brainbytes42
Copy link
Author

Thanks for the quick reply.

My problem is: where would I put this setting? Maybe I'm missing something obvious, but as I have only my on-demand sql-object DAO-interface with its annotation, all I have is the MapMapper.class as reference to the class, but no object to change the setting...?

@stevenschlansker
Copy link
Member

Good point - this looks like it might be an oversight. You can always call handle.registerRowMapper(myConfiguredMapMapper) but this should also be possible to do in annotation-driven configuration.

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

No branches or pull requests

2 participants