user3291110
user3291110

Reputation: 365

Adding Record with Embedded Field in OrientDB Studio

I created a class Vector3 with properties X, Y, Z - all of type double.

I created a class Foo that contains an Embedded field "Position" of type Vector3

In OrientDB studio, I can create a new instance of Foo using the following SQL

insert into Foo set Position = { "X": 1, "Y": 2, "Z": 3}

It works like a charm...

But, if I try to use the schema editor to add a new record, it seems that I cannot just provide

{ "X": 1, "Y": 2, "Z": 3}

as the value of the Position property, but rather I have to specify all this...

{"@type":"d","@class":"Vector3","X":1,"Y":2,"Z":3}

Is there some reason that it cannot deduce the @type and @class - after all, they are part of the class definition.

Also, we are struggling to find where this is covered in the manual or tutorials. So if anyone has a pointer to that, it would be great :)

cheers

Upvotes: 0

Views: 153

Answers (1)

Alessandro Rota
Alessandro Rota

Reputation: 3570

you can create a class Foo that contains a LinkList field "Position" of type Vector3

insert into vector3(X,Y,Z) values(1,2,3)  // @rid=#12:0
insert into vector3(X,Y,Z) values(3,4,5)  // @rid=#12:1
insert into foo(Position) values([#12:0,#12:1])   // @rid=13:1
insert into vector3(X,Y,Z) values(6,7,8)  // @rid=#12:2
update 13:1 add Position = #12:2

Let me know if it can be a solution for you.

Kind regards, Alessandro

Upvotes: 0

Related Questions