嗨,我是 OrientDB 的新手,我在 google 中搜索了这个,我可以找到这个。
http://orientdb.com/docs/last/Binary-Data.html .
可能这个问题不是有效的,但我怀疑存储二进制数据的元素类型是什么。
1.如果我们尝试将图像保存为 Schema Full 属性?
2 如果我们尝试将图像保存为无架构属性?
如上述文档中所述。
ODocument doc = new ODocument();
doc.field("binary", "Binary data".getBytes());
doc.save();
“doc”将保存在哪里?
是否可以举一些有关如何保存图像/二进制数据并检索它的示例。
最佳答案
二进制类型的二进制数据类型是OType.BINARY
如果您没有为文档指定类,它将保存在“默认”簇中。然后您可以使用 SELECT FROM cluster:default WHERE ...
但我强烈建议您不要这样做,还请考虑在 v 3.0 中不再支持自动保存到默认集群(但您仍然可以显式执行 doc.save("default")
)
一般来说,最好创建一个特定的类并将文档保存在那里,例如。
//create the schema only the first time of course
OClass class = db.getMetadata().getSchema().createClass("Image");
class.createProperty("binary", OType.BINARY); // if you want it schemaful
ODocument doc = db.newInstance("Image")
doc.field("binary", "Binary data".getBytes());
doc.save();
关于orientdb - 如何使用java在orientdb中存储和检索图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48187874/