jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jc <jcha...@maned.com>
Subject JCR UnsupportedRepositoryOperationException when a query constraint has "NOT"
Date Thu, 27 Dec 2012 22:33:01 GMT
I am building a query constraint for fetching all the nodes whose names does
not contain a string.

So the way I have approached to build the constraint was as below:

       QueryObjectModelFactory factory =
session.getWorkspace().getQueryManager().getQOMFactory();
        ValueFactory valueFactory = session.getValueFactory();
        
        DynamicOperand operand =
factory.lowerCase(factory.nodeName(DEFAULT_SELECTOR_NAME));
        
        Literal literal;
        Constraint constraint;       
--------------------
--------------------

 literal = factory.literal(valueFactory.createValue(%+ "searchVal" + "%"));
constraint = factory.not(factory.comparison(operand,
QueryObjectModelConstants.JCR_OPERATOR_LIKE, literal));

------------------
-----------------

        
        QueryObjectModelFactory factory = queryManager.getQOMFactory();
        
        Selector source = factory.selector(nodeType, selectorName);
        Column[] columns = null;
        
        return factory.createQuery(source, constraint, orderings,
columns).execute().getNodes();

This throws the "UnsupportedRepositoryOperationException". Any thoughts
please?







--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-UnsupportedRepositoryOperationException-when-a-query-constraint-has-NOT-tp4657295.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message