Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

deleting objects in relations. Searching objects in the opposite direction

21 views
Skip to first unread message

TomekK

unread,
Jun 12, 2017, 6:13:05 PM6/12/17
to OrientDB

Would you please give me a tip about relations in OrientDB and ObjectApi?

Suppose that there are 2 classes

Public class Person {
     Private String name;
     ...
}

Public class Group {
    @ManyToMany
     Private Set <Person> members;
     ...
}
 
And in DB  an object 'myGroup' with linkset to persons_1, person_2

Now we want to remove person_1.

How to prevent situation where members include link to deleted object?
Does OrientDB have a built-in mechanism to remove link from members in this situation?
Is it possible to force OrientDB to return an exception during attempt to remove person_1?

What is the best way to find all group of person_2? Do I need to use sth like "select from group where ..." or is another way?
Above is easy but we can have A with links to B, and B links to C etc. It's easy to move from A to C but what the best way the search objects in the opposite direction?
Reply all
Reply to author
Forward
0 new messages