← Back to Stormify Documentation

enumAsString

val enumAsString: Boolean = false

Whether enum values are stored as their string name instead of ordinal/DbValue.dbValue.

By default (false), enums are stored as integers (ordinal, or DbValue.dbValue for custom mappings). Set to true to store the enum constant's name as a string.

This is equivalent to JPA's @Enumerated(EnumType.STRING).

Examples:

@DbField(enumAsString = true)
var status: Status // Stores "ACTIVE", "INACTIVE", "BANNED"

var priority: Priority // Stores 0, 1, 2 (default ordinal)

Return

true to store enum name as string, false to store as integer (default)