How to repair OrientDB broken links from the java API?

115 views Asked by At

I need to repair some broken links in my OrientDB database. Running REPAIR DATABASE --fix-links from the console works, but I would like to be able to run it from java (scala actually) code.

I tried to execute the REPAIR command as a query but it is not accepted. I also tried to "manually" repair the links by executing commands like

UPDATE Comment SET author = NULL WHERE (SELECT expand(author)) is NULL;

or

UPDATE Comment SET author = NULL WHERE (SELECT expand($parent.$current.author)) is NULL;

but they either trigger an error or have no effect.

How can I repair my broken links from the java API?

1

There are 1 answers

0
WilQu On

I managed to remove the broken links by looking for a property that should be on the linked entity.

UPDATE Comment SET author = NULL WHERE author.id IS NULL;