问题描述
在OrientDB 3.0.33中,我根据the Python OGM example中的Sensor示例创建了一个带有二进制字段的类。 使用以下代码时(与here大致相同)
odocument doc = new odocument("Sensor");
doc.field("name","Test");
doc.field("zone","z1");
OBlob record;
record = db.newBlob("Binary Data".getBytes()); // Files.readAllBytes(fileLocation));
record.save();
doc.field("photo",record);
引发以下异常
Exception in thread "main" java.lang.IllegalArgumentException: Cannot parse binary as the same type as the value (class=com.orientechnologies.orient.core.record.impl.ORecordBytes): #3:6[66,105,110,97,114,121,32,68,116,97] v1
at com.orientechnologies.orient.core.serialization.serializer.OStringSerializerHelper.getBinaryContent(OStringSerializerHelper.java:997)
at com.orientechnologies.orient.core.Metadata.schema.OType.convert(OType.java:331)
at com.orientechnologies.orient.core.record.impl.odocumentHelper.convertField(odocumentHelper.java:239)
at com.orientechnologies.orient.core.record.impl.odocument.field(odocument.java:1463)
at com.orientechnologies.orient.core.record.impl.odocument.field(odocument.java:1294)
at test.App.main(App.java:32)
这大致表明我无法将 ORecordBytes 对象映射到二进制字段中。
当然,如果我只是在一个未知的类(即无模式持久性)上编写一个 odocument ,那么它将起作用。
正确的架构类型是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)