3
如何在數據庫中存儲EnumSet(使用Hibernate)?在休眠中映射EnumSet
@Entity
public class A
{
public static enum SOME_ENUM { A, B, C };
private EnumSet<SOME_ENUM> myEnumSet = EnumSet.of(SOME_ENUM.A, SOME_ENUM.B);
...
...
}
如果我試圖堅持以上,我當然會得到例外。 我想使用@CollectionOfElements,但不推薦使用。有沒有其他的@CollectionOfElements?
有沒有一種方法可以將EnumSet存儲在單個列中,而無需編寫UserType?
謝謝!