@Test
@FixFor( "MODE-2247" )
public void shouldBeAbleToExecuteExceptOperationWithJoinCriteria() throws RepositoryException {

    String sql = "SELECT category.[jcr:path] AS p FROM [nt:unstructured] AS category WHERE ISCHILDNODE(category,'/Cars')"
                 + "EXCEPT "
                 + "SELECT category.[jcr:path] AS p FROM [nt:unstructured] AS category JOIN [car:Car] AS cars ON ISCHILDNODE(cars,category) "
                 + " WHERE cars.[jcr:name] LIKE '%Rover%' OR cars.[jcr:name] LIKE '%Toyota%'";
    Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
    List<String> expectedPaths = new ArrayList<>(Arrays.asList("/Cars/Sports", "/Cars/Luxury"));
    NodeIterator nodes = query.execute().getNodes();
    assertEquals(2, nodes.getSize());
    while (nodes.hasNext()) {
        String path = nodes.nextNode().getPath();
        assertTrue(path + " not found", expectedPaths.remove(path));
    }
}