Bug PropertyCondition equals ""

dataManager.load(User::class.java).all().list()
=> admin OK
=> SELECT ID, ACTIVE, EMAIL, FIRST_NAME, LAST_NAME, PASSWORD, TIME_ZONE_ID, USERNAME, VERSION FROM USER_

dataManager.load(User::class.java).condition(PropertyCondition.equal("username", "UNKNOWN")).list()
=> 0 result OK
=> SELECT ID, ACTIVE, EMAIL, FIRST_NAME, LAST_NAME, PASSWORD, TIME_ZONE_ID, USERNAME, VERSION FROM USER_ WHERE (USERNAME = ?)

dataManager.load(User::class.java).condition(PropertyCondition.equal("username", "")).list()
=> admin !!!
=> SELECT ID, ACTIVE, EMAIL, FIRST_NAME, LAST_NAME, PASSWORD, TIME_ZONE_ID, USERNAME, VERSION FROM USER_

The condition is not in the sql query ! bug in jmix 1 and 2 !

How to get a condition empty string ?

In Jmix prior to 2.2 it works as designed. See IMPORTANT section at Loading Entities by Conditions.

A property condition evaluates to true if its parameter value is empty (null, empty string or empty collection).

In Jmix 2.2 this behavior has been changed so conditions with empty parameters are not skipped anymore, see Handling Empty Conditions.

Regards,
Konstantin

Great,
it’s the behavior that I want in 2.2, I will upgrade my test project before my next ticket !
I would have saved a bit of time if I could have remembered this part of the 2.2 release note.

For 1.5, I think I have to set a jpql condition

dataManager.load(User::class.java).condition(JpqlCondition.create("e.username = ''", null)).list()