On Wed, Feb 16, 2011 at 9:28 AM, Rakesh Vidyadharan <[email protected]>wrote:
> > On 15 Feb 2011, at 20:33, Umashanthi Pavalanathan wrote: > > > Hi , > > > > Jackrabbit's JCR implementation is used in the project I am working on. > > I have got a question about linking two JCR nodes; is there any concept > of > > association/link between two nodes? > > The basic requirement is to create a conceptual connection between two > nodes > > and should be able to retrieve all nodes associated with a node (not the > > case of parent-child nodes; but mostly sibling nodes). I would like to > know > > whether there's any such concept in JCR/Jackrabbit implementation. If > there > > is such feature, I would be glad if you can provide me some links to > > resources. > > I am not too sure about what you are trying to achieve, but you can store > properties in your nodes that can be used to very efficiently retrieve > matching nodes. If you have custom node types, these properties can be auto > created as well. > > Another way of linking is to store node references as path, weakreference > or even a hard reference in your nodes. > My requirement is like this. I represent a *Person *by a node. There are many such *Person *nodes connected with a single *Person* node ( say for eg: friends for that person). I want to build such a relationship/association with the *Person *type nodes. As I understood, keeping a list of node references of other nodes is one option. But I am not sure how much feasible it will since that list might grow and shrink vastly. Can you please explain about the concept of Reference and WeakReferences [1][2] ? [1] http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html#getReferences(java.lang.String) [2] http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html#getWeakReferences() Thanks, ~Umashanthi > Rakesh
