JPA Enum ORDINAL vs STRING

后端 未结 8 1516
予麋鹿
予麋鹿 2021-02-01 13:32

It\'s possible to define enumerations in JPA using either

@Enumerated(EnumType.ORDINAL)

or

@Enumerated(EnumType.STRING)
         


        
8条回答
  •  离开以前
    2021-02-01 14:08

    It depends on your application, if there are more chances that you will add more enums use the String type, if there are more chances that you will change the name of your enums use Ordinal.

提交回复
热议问题