12-13-2013 03:12 AM
I have a standard Content View based on NXQL query.
I want an optional criteria in the query, coming from a seam bean property. In this particular case, it is a flag to show or hide obsolete objects.
Here is the query:
SELECT * FROM Document WHERE ecm:currentLifeCycleState = 'approved'
OR ( ecm:currentLifeCycleState = 'deleted' AND ? = 1 )
? parameter is mapped to a boolean property in a bean.
This query works in 5.6, not in 5.8 (tested with HF03).
Is it a bug or a behavior change? Any other approaches to implement this?
ERROR STACK:
Caused by: org.nuxeo.ecm.core.api.ClientException: Failed to execute query: null
at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1625)
at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.nuxeo.ecm.core.api.TransactionalCoreSessionWrapper.invoke(TransactionalCoreSessionWrapper.java:136)
at com.sun.proxy.$Proxy89.query(Unknown Source)
at org.nuxeo.ecm.automation.core.operations.document.Query.run(Query.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:135)
at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:149)
... 84 more
Caused by: java.lang.NullPointerException
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker$WhereBuilder.getColumnInfo(NXQLQueryMaker.java:1447)
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker$WhereBuilder.visitExpression(NXQLQueryMaker.java:1624)
at org.nuxeo.ecm.core.query.sql.model.Expression.accept(Expression.java:42)
at org.nuxeo.ecm.core.query.sql.model.DefaultQueryVisitor.visitExpression(DefaultQueryVisitor.java:103)
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker$WhereBuilder.visitExpression(NXQLQueryMaker.java:1665)
at org.nuxeo.ecm.core.query.sql.model.Expression.accept(Expression.java:42)
at org.nuxeo.ecm.core.query.sql.model.DefaultQueryVisitor.visitExpression(DefaultQueryVisitor.java:103)
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker$WhereBuilder.visitExpression(NXQLQueryMaker.java:1665)
at org.nuxeo.ecm.core.query.sql.model.Expression.accept(Expression.java:42)
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker$WhereBuilder.visitMultiExpression(NXQLQueryMaker.java:1584)
at org.nuxeo.ecm.core.query.sql.model.MultiExpression.accept(MultiExpression.java:40)
at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker.buildQuery(NXQLQueryMaker.java:455)
at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.query(JDBCMapper.java:750)
at org.nuxeo.ecm.core.storage.sql.SoftRefCachingMapper.query(SoftRefCachingMapper.java:101)
at org.nuxeo.ecm.core.storage.sql.SessionImpl.query(SessionImpl.java:1254)
at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.query(ConnectionImpl.java:368)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession$SQLSessionQuery.execute(SQLSession.java:611)
at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1571)
... 98 more
01-28-2014 05:06 PM
This has been fixed for Nuxeo 5.8-HF06 and Nuxeo 5.9.2, cf NXP-13658.
12-16-2013 11:38 AM
Has nobody else run into this issue?
12-16-2013 12:31 PM
Hi,
12-16-2013 12:38 PM
Thanks for your input.
12-16-2013 01:20 PM
Well, it's very ugly and probably too cumbersome, but in your case (yes, it can work only with your NXQL request, but it's my only idea for the moment) is to replace your '?' by ecm
12-16-2013 02:32 PM
Thanks a lot for your responses manuek!
The solutions/hints you've mentionned made me do more testing and I've noticed a curious combination that works.
In the "A = B" clause:
So, a temporary hack-solution looks like:
SELECT * FROM Document WHERE ecm:currentLifeCycleState = 'approved'
OR ( ecm:currentLifeCycleState = 'deleted' AND ecm:isVersion = ? )
This allows me to keep the structure of the query - having a criteria with it's activation flag along - waiting for the bug fix.
Could nuxeo guys confirm that this is a bug and open an issue? Thanks.
01-28-2014 05:06 PM
This has been fixed for Nuxeo 5.8-HF06 and Nuxeo 5.9.2, cf NXP-13658.
02-02-2014 11:05 PM
Thank you.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.