尝试访问关系文档时出现以下异常:
java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to com.orientechnologies.orient.core.record.impl.ODocument通过:
Collection<ODocument> field = myDoc.field("MY_FIELD_NAME");
if(field != null) {
return field;
} else {
return Collections.emptySet();
}奇怪的是,它并不总是发生,大部分时间它都像预期的那样工作。
发布于 2016-04-23 17:33:21
根据字段包含的内容,您可以使用接口OIdentifiable而不是ODocument。尝试使用:
Collection<OIdentifiable> field = myDoc.field("MY_FIELD_NAME");
if(field != null) {
return field;
} else {
return Collections.emptySet();
}https://stackoverflow.com/questions/36808607
复制相似问题