使用文档 API 设置嵌入字段
Set embedded field using Document API
与https://github.com/orientechnologies/orientdb/issues/3612 and Insert records into embedded field of OrientDB class from select相关
有了开发分支 (2.2),
ODocument product = new ODocument("Product");
ODocument data = new ODocument("Price");
data.field("currency", "EUR");
product.field("data", data);
product.save();
在事务数据库中引发此类错误(而它与非 tx 一起使用):
The field 'Product.price' has been declared as EMBEDDED but the value is a document with the valid RecordID Price#220:-3
这是一个错误吗?
我已经尝试使用 2.2 快照并且它有效
ODatabaseDocumentTx db = new ODatabaseDocumentTx(path);
db.open("root","root");
db.command(new OCommandSQL("create class Product")).execute();
db.command(new OCommandSQL("create property Product.data EMBEDDED")).execute();
db.getMetadata().getSchema().reload();
ODocument product = new ODocument("Product");
ODocument data = new ODocument("Price");
data.field("currency", "EUR");
product.field("data", data);
product.save();
与https://github.com/orientechnologies/orientdb/issues/3612 and Insert records into embedded field of OrientDB class from select相关
有了开发分支 (2.2),
ODocument product = new ODocument("Product");
ODocument data = new ODocument("Price");
data.field("currency", "EUR");
product.field("data", data);
product.save();
在事务数据库中引发此类错误(而它与非 tx 一起使用):
The field 'Product.price' has been declared as EMBEDDED but the value is a document with the valid RecordID Price#220:-3
这是一个错误吗?
我已经尝试使用 2.2 快照并且它有效
ODatabaseDocumentTx db = new ODatabaseDocumentTx(path);
db.open("root","root");
db.command(new OCommandSQL("create class Product")).execute();
db.command(new OCommandSQL("create property Product.data EMBEDDED")).execute();
db.getMetadata().getSchema().reload();
ODocument product = new ODocument("Product");
ODocument data = new ODocument("Price");
data.field("currency", "EUR");
product.field("data", data);
product.save();