Thanks Luigi. 
Worked like a charm!

On Tuesday, February 21, 2017 at 12:10:52 AM UTC-8, Luigi Dell'Aquila wrote:
>
> Hi,
>
> You can create a List<ODocument> and store it as a property value, eg.
>
> OrientVertex v = ...
> List<ODocument> values = new ArrayList<ODocument>();
> for(...){
>   ODocument item = new ODocument("Bid");
>   item.field("bid", 5.01);
>   item.field("buyer", buyer);
>   values.add(item);
> }
> v.setProperty("bids", values);
>
> Just make sure that the schema is correctly defined, ie. that the "bids" 
> property is defined as an embeddedlist, otherwise it will be saved as a 
> link list
>
> Thanks
>
> Luigi
>
>
> 2017-02-20 23:14 GMT+01:00 Borov <[email protected] <javascript:>>:
>
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to