[英]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:使用 JPA,我可以在我的实体中拥有一个映射
enum
并将其作为字符串保存的成员:
@Enumerated(EnumType.STRING)
private MyEnum myEnum;
As JPA doesn't work with R2DBC, I can't use that nice shorthand.由于 JPA 不适用于 R2DBC,所以我不能使用那个漂亮的速记。 Is there a clean way of effecting this mapping when using R2DBC?
使用 R2DBC 时是否有一种干净的方式来影响这种映射?
It will map enum to string and vice versa by default without the annotation.默认情况下,它会将 map 枚举为字符串,反之亦然,无需注释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.