Reputation: 2583
Related to https://github.com/orientechnologies/orientdb/issues/3612 and Insert records into embedded field of OrientDB class from select
With the develop branch (2.2),
ODocument product = new ODocument("Product");
ODocument data = new ODocument("Price");
data.field("currency", "EUR");
product.field("data", data);
product.save();
raises this kind of error with a transactional database (whereas it works with a non tx) :
The field 'Product.price' has been declared as EMBEDDED but the value is a document with the valid RecordID Price#220:-3
Is it a bug ?
Upvotes: 2
Views: 231
Reputation: 3570
I have tried with 2.2 snapshot and it works
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();
Upvotes: 2