Finally, i found the query with Jackrabbit :

select node.* from [nt:unstructured] as node
inner join [nt:file] as file on ischildnode(file, node)
inner join [nt:resource] as content on ischildnode(content, file)
where content.[jcr:mimeType] = 'application/pdf'

Thank you,

Grégory OLIVER



2012/11/13 joe verderber <[email protected]>

> I have a local CQ5 instance running and the following seems to work for me:
>
> Repository r = JcrUtils.getRepository("http://localhost:4502/crx/server/
> ");
>
> Session s = r.login( new SimpleCredentials("admin", "admin".toCharArray())
>   ,"crx.default");
>
> System.out.println("logged in!!!");
>
> NodeIterator ni =  s.getWorkspace().getQueryManager().createQuery("select *
> from [nt:unstructured] where" +
>
> " [nt:unstructured].'jcr:mimeType' like '%/%' ", "JCR-SQL2"
> ).execute().getNodes();
>
> while(ni.hasNext())
>
> {
>
>  System.out.println("currentNode.path='"+ni.nextNode().getPath()+"'");
>
>  System.out.println("currentNode.mimeType='"+ni.nextNode().getProperty(
> "jcr:mimeType").getString()+"'");
>
>   }
>
> s.logout();
>
> System.out.println("logged out.");
>
> On Sun, Nov 11, 2012 at 5:55 PM, [email protected] <
> [email protected]> wrote:
>
> > Hello,
> >
> > I would like to know if it's possible in Jackrabbit with JCR_SQL2 to
> query
> > a node according to the jcr:mimeType property.
> > Something like :
> > SELECT * FROM [nt:unstructured] AS node WHERE node.id = 2 and
> > node.file.jcr:content[jcr:mimeType] = 'application/xml'
> >
> > Thanks,
> >
> > Grégory OLIVER
> >
>

Reply via email to