I try to use @Enumerated annotation fot mapping my enum type, but getting follow error:
Exception in thread "main" java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to java.lang.String
What i do: in postgres
create type "test_type" as enum ('test_1', 'test_2);
in java
public enum TestType{ test_1, test_2 }
@Entity @Table(name="test_table") public class TestTable { ...
@Enumerated(EnumType.STRING) @Column(name="col") private TestType col; ... }