Моя база данных Postgres содержит перечисление типа:
Код: Выделить всё
CREATE TYPE segment_type AS ENUM ('SEG1', 'SEG2');
Код: Выделить всё
@Entity(name = "entity_segments")
public class EntitySegment {
@Id
@Column(name = "my_id")
private UUID myId;
@Column(name = "segment_type", columnDefinition = "segment_type")
@ColumnDefault("'SEG1'")
@Enumerated(EnumType.STRING)
@JdbcType(PostgreSQLEnumJdbcType.class)
SegmentType segmentType = SegmentType.SEG1;
}
Код: Выделить всё
public enum SegmentType {
SEG1,
SEG2
}
Код: Выделить всё
Caused by: org.postgresql.util.PSQLException: ERROR: type "segment_type" does not exist
Подробнее здесь: https://stackoverflow.com/questions/791 ... n-database
Мобильная версия