Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2608

Not possible to update parent node and remove child node within same session if session.save() called several times

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 5.0.0.Final
    • JCR
    • None
    • Hide

      Preparation - create parent node and add child node to it
      1) Start transaction
      2) Create session
      3) update some property on parent node
      4) Call session.save()
      5) Remove child node
      6) Try to call session.save() for second time
      7) You will get exception

      Show
      Preparation - create parent node and add child node to it 1) Start transaction 2) Create session 3) update some property on parent node 4) Call session.save() 5) Remove child node 6) Try to call session.save() for second time 7) You will get exception

      When you try to update parent node, then call session.save() and afterwards remove child node within same session, you will get exception while calling save second time.

      Exception:

      javax.jcr.InvalidItemStateException: This session tried to save changes to node with key 'Cannot locate child node: dbb11dd7505d64c117ec3f-18ae-4eb2-9d65-d762209e3b01 within parent: dbb11dd7505d642bdf0eb7-7e89-4a39-b3bd-287b6ebdf6fd', but it was removed by another session.
      	at org.modeshape.jcr.JcrSession.save(JcrSession.java:1171)
      Caused by: org.modeshape.jcr.cache.NodeNotFoundInParentException: Cannot locate child node: dbb11dd7505d64c117ec3f-18ae-4eb2-9d65-d762209e3b01 within parent: dbb11dd7505d642bdf0eb7-7e89-4a39-b3bd-287b6ebdf6fd
      	at org.modeshape.jcr.cache.document.LazyCachedNode.parentReferenceToSelf(LazyCachedNode.java:238)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getSegment(LazyCachedNode.java:282)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:308)
      	at org.modeshape.jcr.cache.PathCache.getPath(PathCache.java:41)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.persistChanges(WritableSessionCache.java:1002)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:716)
      	at org.modeshape.jcr.JcrSession.save(JcrSession.java:1162)
      	... 31 more 
      

            Unassigned Unassigned
            hot_jira Ostap Shtabura (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: