Reputation: 1
Is there any way to define an enum in spring boot such that a new table for that enum will be created and also they will be mapped to another entities that use the enum?
Upvotes: 0
Views: 944
Reputation: 31
since we added the annotation @Enumerated(EnumType.STRING), Spring Data will save the name of the entity in the database (look, we put a VARCHAR column). If you prefer, you could use EnumType.ORDINAL and Spring Data will save the ordinal value of the entity (1,2,3,etc..), so change the column to accept a numeric value
Upvotes: 1