jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Technical Issue related to Versioning
Date Mon, 15 Dec 2008 09:18:22 GMT
Hi,

pkrishna wrote:
> I have versions of both C and D. If I run the above query, I may get the
> previous versions of both C and D since both may match the criteria of
> having a frozenUuid < than the node UUID and have the same version.

what's the reason you are using the 'less than' operator for the frozenUuid?

>  VersionHistory vh = node.getVersionHistory();            
>  VersionIterator vi = vh.getAllVersions();         
>  vi.skip(1); // this is the root

this might be dangerous. the specification does not mandate a specific order of
versions returned by getAllVersions().

>           while (vi.hasNext()) {
>                
> System.out.println("-----------------------------------------");
>                 Version v = vi.nextVersion();
>                 NodeIterator ni = v.getNodes();
>                 while (ni.hasNext()) {
> 
>                     Node nv = ni.nextNode();
>                     Property p = nv.getProperty("ecr:version");
>                     long val = p.getLong();
>                     System.out.println("Version: " + val);
>                     if (val == version.longValue()) { // interested in
> matching the version
>                         return nv;
>                     }
>                 }
> 
>             }
> 
> The above code execute the version loop ony once and this version reflects
> the current version. I expected the loop to execute atleast twice since I
> have a version 1 and version 2 and I was looking for version 1 but couldn't
> find it.
> 
> Is there a way to find the version I am looking for? am I missing something?

did you double check that you actually created two versions?

regards
 marcel

Mime
View raw message