jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BOWLER Paul" <Paul.Bow...@alcatel-lucent.com>
Subject RE: Newbie: PropertyType.REFERENCE
Date Wed, 01 Jul 2009 16:11:21 GMT
Daniel,

Thanks for the reply, but I don't see how this uses the REFERENCE property to point to another
node?

Can anyone else enlighten me?

Thanks,

Paul.

-----Original Message-----
From: Daniel Manzke [mailto:daniel.manzke@googlemail.com] 
Sent: 01 July 2009 16:57
To: users@jackrabbit.apache.org
Subject: Re: Newbie: PropertyType.REFERENCE

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
View raw message