jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R. Ben Truitt" <btru...@rackspace.com>
Subject Re: versioning / reference question
Date Sat, 29 Jul 2006 18:08:54 GMT
It turns out I was passing the version node, which has a name of  
"*".  Sorry if this is a dumb question, but how do I get the frozen  
node from the version node?

Here is how I'm getting the version node:

//set nodeB to refer specifically to the most recent version of nodeA
nodeB.setProperty("myns:typeA_reference", nodeA.getBaseVersion());

where nodeA.getBaseVersion() returns an object of type Version.

On Jul 29, 2006, at 9:29 AM, Tobias Bocanegra wrote:

> hi ben,
> the constraints are or'd. so your example should work, if you really
> pass the frozen node and not the version node.
>
> regards, toby
>
> On 7/28/06, R. Ben Truitt <btruitt@rackspace.com> wrote:
>> Hi -
>>    I am fairly new to JCR, and am trying to figure out how to do the
>> below scenario:
>>
>>    I've created two node types, myns:typeA and myns:typeB.
>> myns:typeA has as a supertype mix:versionable.  myns:typeB has as a
>> property:
>> - myns:typeA_reference (reference) primary < 'myns:typeA'
>>
>>   So far so good. I can get create NodeA of type myns:typeA and NodeB
>> of myns:typeB, and have NodeB hold a reference to NodeA.  Sweet.
>>
>>   But what I'd *like* to be able to do, is to have NodeB hold a
>> reference to any version (past or present) of NodeA.  I tried
>> modifying my definition for myns:typeB to this:
>> - myns:typeA_reference (reference) primary <
>> 'myns:typeA','nt:frozenNode'
>>
>>   But, when I try to add set the reference property
>> "myns:typeA_reference" to refer to a previous version of NodeA, I get
>> this exception:
>> javax.jcr.nodetype.ConstraintViolationException: [node path here]:
>> does not satisfy the value constraint myns:typeA
>>
>>   So my questions are:
>> 1) Since the JCR spec says that constraints are or'd together, it
>> seems like I shouldn't get this exception. What am I missing here?
>> 2) I'm not very sure I am thinking about this in the right way.  Is
>> there a better way to refer to an arbitrary version of NodeA from  
>> NodeB?
>>
>> Thanks for your help!!
>> -Ben
>>
>
>
> -- 
> -----------------------------------------< tobias.bocanegra@day.com  
> >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001  
> Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com  
> >---


Mime
View raw message