Solved
Creating sub-node within jcr:content - 3rd node from jcr:content is not created
Hi all,
We are using code to programitacally create node in CRX. Using AEM 6.1 . Found that if we want to create 3rd node from "jcr:content" then it does not create 3rd node (in this case 3rd node is "n3").
Refer to this adobe link
//Create a Session javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray())); //Create a node that represents the root node Node root = session.getRootNode(); // Create NodeNode n2 = root.getNode("content/mysite/ mypage/jcr:content/n1/n2") Node n3 = root.addNode("n3"); NOTE : Node "n2" already exists. (content/mysite/mypage/jcr: content/n1/n2)
Any reason why the above code does not create node at 3rd level from "jcr:content" ? Is there any limitation of JCR ?
Using same code if we use "addNode" for creating any node parallel to "n1" then we are able to create that node
// Create NodeNode n1 = root.getNode("content/mysite/ mypage/jcr:content/n1") Node n11 = root.addNode("n11");