You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sridhar Raman <sr...@gmail.com> on 2008/01/30 07:01:53 UTC

Restore a node with reference to another deleted node

Hi

I have a versionable node (nodeA), which contains a reference (to nodeB)
property.  The problem I face is when I delete the nodeB that an earlier
version of nodeA refers to.  Note:  The current version of nodeA doesn't
refer to the nodeB.  Hence, the deletion of nodeB doesn't cause any
referential intergrity problems.  So far this is working as I want it to.
But if I try to restore nodeA to the earlier version (where there was a
reference to nodeB), I get this error:
javax.jcr.nodetype.ConstraintViolationException: failed to check REFERENCE
value constraint:

How do I overcome this problem?  I can think of 2 solutions:
1)  I keep versions of nodeB as well.  So that, before restoring nodeA, I
restore nodeB to the corresponding version:
This approach has 2 major problems:
i)  How do I restore the version of a deleted node?
ii)  Would it be possible to keep a common label to the versions of nodeA *
and* nodeB.

2)  Since, the previous approach seems to be fraught with major problems,
how about a solution where I can restore the node "temporarily", and
probably discard all values that violate constraints?  Is this even
possible?

Thanks in advance,
Sridhar