You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by jc <jc...@maned.com> on 2012/12/27 23:33:01 UTC
JCR UnsupportedRepositoryOperationException when a query constraint
has "NOT"
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.