jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viz06 <vijaykumarsharma_1...@yahoo.com>
Subject Adding child to node obatined from iterator doesn't work
Date Wed, 25 Jun 2008 09:16:58 GMT

Please bear with me as I am trying to explain my situation

I have a requirement where I need to search for a node and then add a child
to this node. 

To achieve this I am running a query something like this
"//nms:myroot/*/nms:mynode" which returns an NodeIterator, from this I pick
the node which satisfied other condition (matching properties) and add the
child node. Very straightfoward.

When I save the child (jcrTemplate.save()) I get the child uuid which tell
me that the child node addition does work. But to my surprise session is not
flushed as next call (in separate txn) to get the earlier saved child
results in javax.jcr.ItemNotFoundException:

Instead of adding the child directly to the node obtained from iterator if I
do something like jcrTemplate.getNodeByUUID(uuid of node from iterator) then
add the child everything works fine.

I skimmed thru the ItemImpl code and came across method getTransientStates()
which is used to identify if the node has any modifications. For first case
where I add child to node obtained from iterator this returns list of size 0
but for other case list is not empty.

I am using spring modules but this doesn't seems to be related to this.

Let me know if all this makes any sense.
View this message in context: http://www.nabble.com/Adding-child-to-node-obatined-from-iterator-doesn%27t-work-tp18108121p18108121.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message