You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torgeir Veimo <to...@netenviron.com> on 2009/11/18 14:59:13 UTC

uuid as column in QueryResult

Is there a way to get an uuid as one of the values in a row, when
fetching a row from a QueryResults?

I'd like to call;

RowIterator iterator = queryResult.getRows();
while (iterator.hasNext()) {
  Row row = iterator.nextRow();
  String id = row.getValue(JcrConstants.JCR_UUID).getString();
[...]
}

-- 
-Tor

Re: uuid as column in QueryResult

Posted by Alexander Klimetschek <ak...@day.com>.
On Wed, Nov 18, 2009 at 14:59, Torgeir Veimo <to...@netenviron.com> wrote:
> Is there a way to get an uuid as one of the values in a row, when
> fetching a row from a QueryResults?
>
> I'd like to call;
>
> RowIterator iterator = queryResult.getRows();
> while (iterator.hasNext()) {
>  Row row = iterator.nextRow();
>  String id = row.getValue(JcrConstants.JCR_UUID).getString();
> [...]
> }

You have to go over a Node object. In JCR 1.0 you have to do this:

Node node = (Node) session.getItem(row.getValue("jcr:path").getString());
String uuid = node.getUUID();

In JCR 2.0 it's simpler:
Node node = row.getNode();
String uuid = node.getUUID(); // or node.getIdentifier()

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com