Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
要将int转换为枚举,该int不是枚举常数的序列(),您需要查找功能。您已经将整数值分配给常数,因此剩下的就是查找本身:
To convert an int to an enum where that int is not the ordinal() of the enum constants, you need a lookup function. You already assigned the integer values to the constants, so all that is left is the lookup itself:
好吧,我必须得到有关枚举世界的更多记录。如果有人与我同样的问题是对我有用的解决方案:
href =“ https://www.baeldung.com/jpa-pa-persisting-enums-inums-in-jpa“ rel =“ nofollow noreferrer”>链接对我有很大帮助
typecolor.java ,
所以我需要的缺少部分是以下类,该类使数据库中的列与使用JPA 2.1
typecolorconverter.java <<< /strong>
Well, I had to get documented more about enum world. If anyone having the same issue as me here is the solution it worked for me :
this link helped me a lot
TypeColor.java
So the missing part I needed is the following class that makes the mapping between the column in database and enum using JPA 2.1
TypeColorConverter.java