@jayv25585659 For orderBefore to work properly ,
Node mynode = session.getNode("/content/mysite/en/jcr:content/content/section/par_1);
mynode.orderBefore("oldnode", "newnode")
Your myNode should be the parent node , and first argument should be your node name ( you want to insert) and second argument should be the the node name immediately below which you want to insert it.
https://docs.adobe.com/docs/en/spec/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#orderBefore(java.lan...
orderBefore
void orderBefore(java.lang.String srcChildRelPath,
java.lang.String destChildRelPath)
throws UnsupportedRepositoryOperationException,
VersionException,
ConstraintViolationException,
ItemNotFoundException,
LockException,
RepositoryException
If this node supports child node ordering, this method inserts the child node at srcChildRelPath into the child node list at the position immediately the child node at destChildRelPath.
To place the node srcChildRelPath at the end of the list, a destChildRelPath of null is used.
Also please refer some sample her https://www.codota.com/code/java/methods/javax.jcr.Node/orderBefore
Hope this helps
Thanks
Veena