jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Manzke <daniel.man...@googlemail.com>
Subject Re: Newbie: PropertyType.REFERENCE
Date Wed, 01 Jul 2009 15:56:58 GMT
Hi Paul,
here is a snippet.

Node rootNode = session.getRootNode();
Node record = rootNode.getNode(recordPath); //retrieves a node for an
electronical record
Node document = rootNode.getNode(documentPath); //retrieves a node for an
document in another record
*Value value = session.getValueFactory().createValue(document); //creates
the reference value*
*record.setProperty("forge:Referenzen", new Value[]{value}); //setting the
reference property*
session.save();


I don't know if this is the best way. If I remember right, I took the way
out of the TCK-Tests. ;)


Greets,
Daniel

2009/7/1 BOWLER Paul <Paul.Bowler@alcatel-lucent.com>

> Can anyone demonstrate (in code) how to set one Node to point to another
> Node using node.setProperty(xxx, xxx, PropertyType.REFERENCE).
>
> I can't find any examples anywhere on how to do this!
>
> Thanks,
>
> Paul.
>
> P.S. Is there a good JCR book available that I can read?
>



-- 
Mit freundlichen Grüßen

Daniel Manzke

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