I have entity
@Entity(name = "myEntity")
@Table(name = "my_entity")
@TypeDef(name = "pgsql_enum", typeClass = PostgreSQLEnumType.class)
public class MyEntity implements Serializable {
@NotNull
@Column(name = "custom_type", columnDefinition = "custom_type_enum")
@Enumerated(EnumType.STRING)
@Type(type = "pgsql_enum")
@Convert(converter = CustomTypeConverter.class)
private CustomType type = CustomType.UNKNOWN;
}
I have a problem, in case there in db unknown enum value – I need to set it with default value – UKNOWN, but when I use Enumerated – Jpa Convert is not triggered, so I removed Enumerated, but now I am getting error Caused by: org.hibernate.AnnotationException: AttributeConverter and explicit Type cannot be applied to same attribute [...];remove @Type or specify @Convert(disableConversion = true)
how to deal with it?