java - How to map a many-to-many relantionship in OrientDB -
I am starting with Orient DB and I got basic rights. But I did not know how to map many relationships in a way, so that I would not need to check for many integrity when removing the record.
I am using an object database (ODatabaseObjectTx) and I am trying to map this simple relationship:
The person & lt; -> roles
A person can have many roles and one role can be assigned to multiple individuals. N to M Relationships
My person category:
public class person {name of private string; Public person () {} public string getName () {return name; } Public Zero Setname (string name) {this.name = name; }}
My role class:
Role of the public class {Name of the private string; Public role () {} public string getName () {return name; } Public Zero Setname (string name) {this.name = name; }}
Now I do not understand that to make set
to user
class or a link < Code> roll
in the category & lt; Users & gt; Set in any way if I remove one record from one, then I have to check the link of another to avoid the null
references. I set in the
is more convenient to set up. user
category & lt; Role & gt;
In an RMDBS, you can only create a foreign key and add some cascading rules, does Orient DB provide similar functionality to save the problem of manually doing so?
Finally, I have to do this manually, so what strategy do I need? Should the record be removed completely by checking the other cluster? Should I just leave null
and handle them when I see them? Do I need to make a double reference ( set in & lt; role & gt;
in user
and set
in Role
I think it will quickly remove more space and at the expense of complexity?)
Take a look at the documentation:
Comments
Post a Comment