jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sriraj paul <srirajp...@yahoo.co.uk>
Subject Create association between nodes without session.save
Date Wed, 08 Sep 2010 08:01:27 GMT
Hi,

I want to create an association between nodes.

I have the following code
Node testNode=session.getRootNode().addNode("testNode");
Node 
testNode1=testNode.addNode("testNode1","nt:folder");testNode1.addMixin("mix:referenceable");session.save();
 //need to remove thistestNode.setProperty("child1", testNode1);
session.save();
 
This works perfectly fine. But can I do it with just one session.save(); . The 
one given at the end.
 
i.e. if I give the following code it is giving exception.
 
Node testNode=session.getRootNode().addNode("testNode");
Node 
testNode1=testNode.addNode("testNode1","nt:folder");testNode1.addMixin("mix:referenceable");testNode.setProperty("child1",
 testNode1);
session.save();
 
The exception is javax.jcr.ValueFormatException: Target node must be of node 
type mix:referenceable
Can I do it with one session.save() at the end?
 
Thank you
Sriraj
 
 
Exception in thread "main" 


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message