@FixFor( "MODE-2297" ) @Test public void shouldExecuteQueryUsingSetOperationOfQueriesWithConstraintsOnNonExistantProperties() throws RepositoryException { String sql1 = "SELECT BASE.[jcr:path] from [nt:propertyDefinition] as BASE " + "JOIN [nt:nodeType] AS A ON ISCHILDNODE(BASE,A) " + "JOIN [nt:unstructured] AS B ON B.[jcr:uuid] = A.[jcr:uuid] " + "WHERE B.[jcr:multiple] = true"; Query query = session.getWorkspace().getQueryManager().createQuery(sql1, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); String sql2 = "SELECT BASE.[jcr:path] from [nt:unstructured] as BASE " + "JOIN [nt:nodeType] AS A ON ISCHILDNODE(BASE,A) " + "JOIN [nt:unstructured] AS B ON B.[jcr:uuid] = A.[jcr:uuid] " + "JOIN [nt:unstructured] AS C ON C.x = BASE.[jcr:uuid] " + "WHERE A.propertyThatHasntToExistsAtAll = '2'"; query = session.getWorkspace().getQueryManager().createQuery(sql2, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); String sql = sql1 + " UNION " + sql2; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); sql = sql2 + " UNION " + sql1; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); sql = sql1 + " INTERSECT " + sql2; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); sql = sql2 + " INTERSECT " + sql1; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); sql = sql1 + " EXCEPT " + sql2; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); sql = sql2 + " EXCEPT " + sql1; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); validateQuery().rowCount(0).validate(query, query.execute()); }
@Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages(); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages();  }