我使用的是OrientDB,我想在一个字段中保存一个枚举。喜欢的东西:在OrientDB中保存Java枚举
db.save(new ODocument("Car").field("color", Colors.BLUE));
这是我得到的错误:
Exception in thread "main" com.orientechnologies.orient.core.exception.OSerializationException: Cannot serialize the object since it's not implements the OSerializableStream interface
最简单的办法来解决,这将是使“颜色”属性String
,然后保存它像Colors.BLUE.name()
但如果是这样的话,我很确定东方应该有办法为我处理这个问题,或者更好的办法是以更高效的方式处理这个问题。
有谁知道使用枚举的更好方法是什么?
你使用的是什么版本? – Ami
@ILLA我使用的是1.2.0版本 –