views:

209

answers:

1

Hi, I am using Jackrabbit with JCR, how can I change the order of the nodes?

+4  A: 

There are a number of ways;

1) Create a parent node type with the option "orderable".

[ns:NodeType] > ns:ParentType1 orderable
....
..

Now you can use the [orderBefore][1] method to order the nodes.

2) Use can use a SQL/XPATH query to order the nodes returned. e.g.

//element( *, blabla:nodes) order by
@blabla:title descending

[1]: http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html#orderBefore(java.lang.String, java.lang.String)

Waverick