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
Automapping enums properties #72
Comments
I'll have a look |
What use case are you after, mapping a column directly to an enum or mapping a number of columns to a class where the fields are possibly enums? Both perhaps? |
Was hoping it can support mapping a number of columns to to a class where some fields are enums, not sure what you mean mapping a column directly to an enum, maybe that's also useful if you're after a single column where the value is represented by a an enum, the other use case i have is the following where the enum is used as a parameter to a statement:
BTW, thanks a lot for an amazing lib, good solution to what big companies like ibm fail to address |
Thanks, glad you find it useful. I'd suggest you be quite specific with the parameter and pass For automapping to an interface I suggest an approach like below. That way if you rename your enums (assuming that you serialize an enum to its interface PersonWithEnum {
@Column
String name();
@Column("gender")
String genderCharacter();
default Gender gender() {
return Gender.fromCode(genderCharacter());
}
} I've added an example to DatabaseTest.java: rxjava2-jdbc/rxjava2-jdbc/src/test/java/org/davidmoten/rx/jdbc/DatabaseTest.java Lines 3553 to 3598 in a4355c0
|
thanks that makes sense, i just got used to spring where it provides converters for you, but this is good enough |
Is there a way for automapping a string to enums on select and enums to string when using as query parameter?
The text was updated successfully, but these errors were encountered: