【发布时间】:2018-02-19 12:19:43
【问题描述】:
我在 DB String 列中有值
0101
0111
1110
我想在我的实体中创建枚举并增加价值。
public enum MyEnum{
NEW("0101","created new"),
SUCCESS("0111", "created success),
ERROR("1110", "created with error");
}
我想通过 MyEnum 的第一个参数从 DB 映射值并在我的代码中获取第二个参数。像这样的:
hz.getMyEnum().value() // I need return created new or created success
【问题讨论】:
-
尝试使用
@AttributeConverter?