jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matej Knopp" <matej.kn...@gmail.com>
Subject Re: ReferentialIntegrityException not being recoverable
Date Thu, 20 Mar 2008 17:35:24 GMT
Hi,

>  >
>  >  I have a problem with referential integrity. When attempting to remove
>  >  node that is referenced by other nodes I get a
>  >  ReferentialIntegrityException. So far so good. But when I catch the
>  >  exception and want to work with the node, i get
>  >  javax.jcr.InvalidItemStateException:
>  >  c47e08bd-ac12-4565-8b32-347062c780ed: the item does not exist anymore.
>  >
>  >  Looks like the item is still marked as removed within the session.
>  >  That would make sense to me if I could revert the deletion by calling
>  >  .refresh(false). However refresh(false) called on node, parent or
>  >  session after the ReferentialIntegrityException doesn't help.
>
>  the Node instance has been discarded through the Item.remove() call.
>  calling refresh currently doesn't resurrect previously discarded Item instances.
>
I don't think this is stated anywhere (spec or javadoc). But I might
be wrong. Still, I think calling refresh restoring deleted node is
intuitive behavior. So unless it is too complicated to implement this
I think it would make sense. I'll file a Jira issue.

Thanks for the reply.
Matej

>  i am not sure whether that's a bug according to the spec, i'll have to check
>  the spec.
>
>  anyway, retrieving a fresh Node instance should solve your problem, e.g.
>
>             String s = target.getPath();
>             target.remove();
>             try {
>                 session.save();
>             } catch (ReferentialIntegrityException rie) {
>                 session.refresh(false);
>             }
>             target = (Node) session.getItem(s);
>
>
>  BTW: if you think that the current behaviour is actually a bug please feel free
>  to file a jira issue.
>
>  happy easter!
>  stefan
>
>
> >
>  >  I'm using latest trunk.
>  >
>  >  Thanks.
>  >
>  >  Matej
>  >
>



-- 
Resizable and reorderable grid components.
http://www.inmethod.com

Mime
View raw message