jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Kiehl <christ...@sulu3000.de>
Subject Re: Finding the latest version of a node
Date Wed, 09 May 2007 10:20:31 GMT
harvey waters wrote:
> Anybody know a quick way of finding the most recent version of a node,
> currently I iterate through all the versions in the version history and 
> look
> for the Version node that has no successors, is this the quickest way of
> doing it ?

If you want to get the latest version of a node in your workspace you can use 
getBaseVersion():

Node node = getSession().getNodeByUUID(uuid);
Version version = node.getBaseVersion();
Node versionNode = version.getNode(JcrConstants.JCR_FROZENNODE);

AFAIK this base version might be different in different workspaces.

Cheers,
Christoph


Mime
View raw message