Hi,

I have a class with a property type of EMBEDDEDLIST of other class. I 
simply want to add multiple items to the list at once to an already 
existing class record. 

Here are 2 class examples:

create class Item extends V
create property Item.name STRING
create property Item.bids EMBEDDEDLIST Bid

create class Bid
create property Bid.created DATETIME (DEFAULT "sysdate()", READONLY TRUE)
create property Bid.buyer LINK Account
create property Bid.bid DOUBLE

Let say I already have an Item and 10 bids for it. I want to add all 10 
bids to the Item class at once. I know I can simply have a query like this 
to add bids with JSON array:

String jsonBids = "[{"buyer":"
#25:1","bid":5.01,"@type":"d","@class":"LeadBid"},{"buyer":"#26:1","bid":10.0,"@type":"d","@class":"LeadBid"}]";

String sql = "update ? add bids = " + jsonBids;
db.command(new OCommandSQL(sql)).execute(new ORecordId(leadRid));

But, is there a straight forward way of doing this in Java using Document 
or Graph API? So, I wouldn't have to first construct JSON object, then loop 
to appending @type and @class elements, to make it OrientDB recognizable 
doc and class type, then concatenate my query string with that JSON string.

Thanks,

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to