cancel
Showing results for 
Search instead for 
Did you mean: 

Nuxeo 5.6 to 5.8 - boolean values processing in NXQL bug or change?

promanov_
Star Contributor
Star Contributor

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
1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

This has been fixed for Nuxeo 5.8-HF06 and Nuxeo 5.9.2, cf NXP-13658.

View answer in original post

7 REPLIES 7

promanov_
Star Contributor
Star Contributor

Has nobody else run into this issue?

manuek_
Star Contributor
Star Contributor

Hi,

promanov_
Star Contributor
Star Contributor

Thanks for your input.

manuek_
Star Contributor
Star Contributor

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

promanov_
Star Contributor
Star Contributor

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:

  • the value-flag coming from seam bean put on the right position
  • on the left position put the term ecm:isVersion that works in my case giving the constant "1" as I don't use versionning on these particular doc types 🙂 (still pretty ugly, huh, and dangerous)

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.

Florent_Guillau
World-Class Innovator
World-Class Innovator

This has been fixed for Nuxeo 5.8-HF06 and Nuxeo 5.9.2, cf NXP-13658.

Thank you.

Getting started

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.