Hi,

Do you mean by SQL or by Java API ?

If you want to modify it by Java API just do:

List<ODocument> resultList = db.query(new OSQLSynchQuery<ODocument>("SELECT
FROM User WHERE username = 'Tomek'"));
ODocument user = resultList.get(0);
user.field("roleSet").add(rola1);
user.save();

or you have some troubles with this ?



On Fri, Aug 22, 2014 at 3:28 PM, Tomek <[email protected]> wrote:

> How to modify a Set<ODocument> field in a record?
>
> the code:
> List<ODocument> resultList = db.query(new
> OSQLSynchQuery<ODocument>("SELECT username, roleSet FROM User
> WHERE username = 'Tomek'"));
>
> System.out.println("resultList_0: " + resultList_0);
> System.out.println("resultList_0: " + resultList_0.field("roleSet"));
> Returns:
> resultList_0: #-2:1{username:Tomek,roleSet:[2]} v0
> resultList_0: [#10:0=#10:0,#10:1=#10:1]
>
> #10:0 and #10:1 are records in Role class.
>
> How to add a new record to this set, or delete one from it?
>
> I create a new one:
> ODocument rola1 = new ODocument("Role");
> rola1.field("role", "myRole3");
> db.save(rola1);
> but can't add it.
>
> --
>
> ---
> 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.
>



-- 
Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

-- 

--- 
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