From: Richard Millet Date: Fri, 26 Feb 2010 21:52:32 +0000 (+0000) Subject: CSPACE-1069: Need to parenthesize 'where' clause of DocumentHandler for correct NXQL... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=cf04951bbe3e2b63aab4852b73c7d234ed4f9cd0;p=tmp%2Fjakarta-migration.git CSPACE-1069: Need to parenthesize 'where' clause of DocumentHandler for correct NXQL -> SQL translation --- diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java index 22b49af62..620fa66aa 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java @@ -307,8 +307,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient { // We should make this a property that is indexed. query.append(" WHERE ecm:path STARTSWITH '/" + domain + "'"); if ((null != where) && (where.length() > 0)) { -// query.append(" AND " + where); - query.append(" AND " + where + "AND ecm:isProxy = 0"); + // Due to an apparent bug/issue in how Nuxeo translates the NXQL query string + // into SQL, we need to parenthesize our 'where' clause + query.append(" AND " + "(" + where +")" + "AND ecm:isProxy = 0"); } DocumentModelList docList = null; // If we have limit and/or offset, then pass true to get totalSize @@ -319,6 +320,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient { } else { docList = repoSession.query(query.toString()); } + + if (logger.isDebugEnabled()) { + logger.debug("Executed NXQL query: " + query.toString()); + } + //set repoSession to handle the document ((DocumentModelHandler) handler).setRepositorySession(repoSession); DocumentWrapper wrapDoc = new DocumentWrapperImpl(docList);