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

Child node definition not found for versioned shared node

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 2.8.2.Final
    • 2.8.0.Final
    • None
    • None

      Using the following node definitions

      [A] > mix:versionable
        - name (string) copy
        + b (B) multiple copy
        + c (C) multiple copy
      
      [B]
        - name (string) copy
        + c (C) multiple copy
      
      [C] > mix:shareable
        - name (string) copy
      

      When I run the following bit of code (full code in the forum post) with an existing simple tree of nodes that is /a/b/c I get a ConstraintViolationException.

      71:  versionManager.checkout(a.getPath());
      72:  workspace.clone(workspace.getName(), c.getPath(), "/a/c", false);
      73:  versionManager.checkin(a.getPath());
      

      The code is trying to clone the node at /a/b/c to /a/c which should create a shared node that is at both /a/b/c and at /a/c. The clone operation works fine but I get the exception at the line that does the checkin.

      The error is:

      javax.jcr.nodetype.ConstraintViolationException: Cannot find a definition for the child node named 'c' on the node at '/a' with primary type 'A' and mixin types: []
                at org.modeshape.jcr.SessionCache.save(SessionCache.java:509)
                at org.modeshape.jcr.AbstractJcrNode.save(AbstractJcrNode.java:2256)
                at org.modeshape.jcr.JcrVersionManager.checkin(JcrVersionManager.java:384)
                at org.modeshape.jcr.JcrVersionManager.checkin(JcrVersionManager.java:1738)
                at au.com.infomedix.documentstore.cnd.TestSharedVersioned.main(TestSharedVersioned.java:73)
      Caused by: org.modeshape.graph.session.ValidationException: Cannot find a definition for the child node named 'c' on the node at '/a' with primary type 'A' and mixin types: []
                at org.modeshape.jcr.SessionCache$JcrNodeOperations.preSave(SessionCache.java:2930)
                at org.modeshape.graph.session.GraphSession$4.finishParentAfterLoading(GraphSession.java:1115)
                at org.modeshape.graph.session.GraphSession$LoadAllChildrenVisitor.finish(GraphSession.java:3449)
                at org.modeshape.graph.session.GraphSession$Node.onChangedNodes(GraphSession.java:3182)
                at org.modeshape.graph.session.GraphSession.save(GraphSession.java:1112)
                at org.modeshape.jcr.SessionCache.save(SessionCache.java:507)
                ... 4 more
      

      If I change the type of the child node c in node A to "nt:base" then the error goes away and it works as expected.
      ie:

      [A] > mix:versionable
        - name (string) copy
        + b (B) multiple copy
        + c (nt:base) multiple copy
      

              rhauch Randall Hauch (Inactive)
              bwallis42_jira Brian Wallis (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: