Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有如下枚举。
私人性行为;公共枚举性别{男性,女性,其他}
Openxava 将值数据库保存为 0,1,2。但我想保存实际值,如“MALE”、“FEMALE”和其他。
如何使用 Openxava 做到这一点?
我有一些具有更多值的枚举,而不仅仅是这个枚举。
我正在使用共享数据库,如果我将值保存为 0、1、2 其他应用程序将失败。
和
如何在下拉列表 0 位置添加空白元素并且用户无法选择空值。
请帮我解决这个问题...
谢谢...
使用@Enumerated(EnumType.STRING):
@Enumerated(EnumType.STRING) private Sex sex;
这不是 OpenXava 特有的,它是 JPA 功能。