Search code examples
javaspring-data-r2dbc

Mapping an enum to String in R2DBC


Using JPA, I can have a member within my entity that maps an enum and persists it as a String:

    @Enumerated(EnumType.STRING)
    private MyEnum myEnum;

As JPA doesn't work with R2DBC, I can't use that nice shorthand. Is there a clean way of effecting this mapping when using R2DBC?


Solution

  • It will map enum to string and vice versa by default without the annotation.