我正在尝试使用Hibernate将一组枚举类型存储到数据库中。
该枚举类型的定义类似于:
public enum SomeEnum {
ITEM,
ITEM2,
}
我有一个像这样的Hibernate模型实体
@Entity
public class TableObject implements BaseObject {
private Long id;
private Set<SomeEnum> someEnumSet;
@Column(name = "TABLE_COLUMN", nullable = true, insertable = true, updatable = true)
@ElementCollection
public Set<SomeEnum> getSectionSet() {
return sectionSet;
}
public void setSectionSet(Set<SomeEnum> sectionSet) {
this.sectionSet = sectionSet;
}
}
我认为@ElementCollection注释不正确。 ‘TABLE_COLUMN’列在数据库中的类型为CLOB。(Oracle)
谢谢, Alex。