I try to create a field as type EMBEDDEDLIST from Java.
But when I try to create it, is considered as LINK.
If I define a field by Studio as EMBEDDELIST with linked class, Java works properly.
My code:
String fieldName = "trialEmbedded";
List<ODocument> fieldDataItem = doc.getData().field(fieldName);
DataItem di = DataItemFactory.create(dtValidita, importo, descrizione, db);
if (fieldDataItem == null) {
fieldDataItem = new ArrayList<ODocument>();
}
fieldDataItem.add(di.getData());
doc.setField(fieldName, fieldDataItem);
In the doc variable (type ODocument) when I save it, on DB (querying by Studio) I've got in column "trialEmbedded" a link (orange box with @rid clickable), if I specify field as EMBEDDEDLIST works properly.
I resolved in very simple way.
I used the signature of setField with OType parameter, like this:
this.data.field(fieldName, fieldDataItem, OType.EMBEDDEDLIST);