> On Feb 29, 2020, at 11:35 AM, Aye Thu <
aye...@gmail.com> wrote:
>
>
> This id is used to save and query enums to/from the DB (and not the ordinal value). I created a custom ColumnMapper and a custom ColumnMapperFactory to handle this but am now trying to figure out how to "register" this so that the BeanMapper will use these. How can I do this (or am I even on the right path)?
It should be as simple as calling registerColumnMapper(new AppStateColumnMapperFactory()) on your Jdbi before opening a handle that uses it.
Keep in mind that with latest Jdbi there's a new argument preparation facility, if you write a custom ArgumentFactory as well please consider implementing ArgumentFactory.Preparable otherwise the "vanilla" enum binder might win over yours anyway.
>
> In the docs I saw EnumStrategy but it doesn't look to be extensible (or customizable) this made me more confused concerning the right direction to handle custom enums.
Right, these are just the built-in strategies. You're on the right track, writing a custom mapper for a custom type, rather than thinking of it as a special enum strategy. (An enum is just a special case of "custom type")