我正在尝试使用hibernate将一组枚举存储到数据库中.
枚举就像是
public enum SomeEnum {
ITEM,
ITEM2,
}
Run Code Online (Sandbox Code Playgroud)
我有一个像这样的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;
}
}
Run Code Online (Sandbox Code Playgroud)
我不认为@ElementCollection注释是正确的.'TABLE_COLUMN'列在DB中的类型为CLOB.(甲骨文).
谢谢,亚历克斯.