Here's my enum
Code:
public enum AccountType implements NamedEnum {
vertical("Virtual Business"), member("Member"), alert("Alert Subscriber");
private AccountType(final String value) {
this.value = value;
}
private String value;
public String getValue() {
return value;
}
public String toString() {
return getValue();
}
}
and i want to store in db not number (1,2 and etc) and not enum name( vertical, member ...) but this enum value property ("Virtual Business", "Member" and etc...).
For this purpose i wanted to create own UserType and expected to recieve params for this persistent property:
Code:
@Type(type = "NamedEnumType")
@Column(name = "account_type", updatable = false, length = 25)
public AccountType getAccountType() {
return accountType;
}
Existed EnumType is working and it receieves params such enum class but my own which equals Hibernate EnumType ( I'll change it in the future when understand the problem wiith params) doesn't work.
I tried to add @Enumerated() but it didn't help.
With @Enumerated(EnumType.STRING) it's working but it stores enum name not my enum property.