JPQL Exception in Value Collection DataSource

When I execute below query ,

select wl.exeName, 
count(wl.exeName) exe_count
from worklog$WorkLog wl where wl.exeName IS EMPTY
group by wl.exeName
order by exe_count desc

I get Exception as

com.haulmont.cuba.core.global.RemoteException:
---
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Problem compiling [
                select wl.exeName, 
count(wl.exeName) exe_count
from worklog$WorkLog wl where wl.exeName IS EMPTY
group by wl.exeName
order by exe_count desc
            ]. 
[77, 87] The collection-valued path 'wl.exeName' must resolve to an association field.
---
org.eclipse.persistence.exceptions.JPQLException: 
Exception Description: Problem compiling [
                select wl.exeName, 
count(wl.exeName) exe_count
from worklog$WorkLog wl where wl.exeName IS EMPTY
group by wl.exeName
order by exe_count desc
            ]. 
[77, 87] The collection-valued path 'wl.exeName' must resolve to an association field.

It is syntactically illegal to compose a path expression from a path expression that evaluates to a collection.
You should use JOINs if you want to jump to another entity’s properties.

I use Single Entity only

I think the problem with wl.exeName IS EMPTY. Try to rewrite it with: wl.exeName is null or wl.exeName is not null

If I use wl.exeName is not null ,the null value column also getting displayed.Its not working.

The IS [NOT] EMPTY operator only applied for collection-association properties.

If I use wl.exeName is not null ,the null value column also getting displayed.Its not working.

May be empty string in the value exeName. Try to use LENGTH and TRIM JPQL functions.

If I use LENGTH,Its working fine.

Thank you.

1 Like