On 2/27/06, Carlos Villegas <[EMAIL PROTECTED]> wrote:
> What does the following exception mean:
>
> javax.jcr.InvalidItemStateException:
> d35eb7b6-ca1a-4c18-98fc-0aa0ee9b8987: the item cannot be saved because
> it has been modified externally.
>
> There's only one application using the repository. What could be happening?
this exception indicates that you have 2 separate sessions that try to modify
the *same* item.
the following code fragment illustrates this:
Node a1 = session1.getRootNode().getNode("a");
Node a2 = session2.getRootNode().getNode("a");
// session 1 modifies node a
a1.addNode("b");
// session 2 modifies node a
a2.addNode("c");
// session 1 saves its changes
a1.save();
// session 2 tries to save its changes but gets
// an InvalidItemStateException because its
// changes have become stale
a2.save(); // throws
you can avoid such situations if you lock the node before
you start modifiying it.
cheers
stefan
>
> Carlos
>