You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
io.jmix.core.repository.JmixDataRepositoryContext has been added to pass io.jmix.core.querycondition.Condition and other Jmix-related paramters to Jmix Data Repositories. It allows to dynamically change them at runtime for repository methods.
Implementation:
Supported by io.jmix.core.repository.JmixDataRepository standard methods.
Supported as paramter of user-defined methods, e.g.:
Jmix Data Repositories use io.jmix.core.querycondition.Condition under the hood. Condition originally have been designed to work with UI filter conditions where null value in field means that no filtering needed because value is not specified.
Unfortunately this is not correct behaviour for Data Repositories.
Solution:
Rework Conditions and Repositories in order to take nulls as parameters
Implementation:
Conditions in UI: old behaviour, conditions with absent, null or empty parameter will be skipped.
[breaking changes] JmixDataRepositories in new projects: derived methods will no longer skip conditions with null or empty values. Set jmix.core.skip-null-or-empty-conditions-by-default=true to return old behaviour for project
[breaking changes] Manually created conditions in app code of new projects: will be applied even when parameter absent, null or empty.
Set jmix.core.skip-null-or-empty-conditions-by-default=true to return old behaviour for all project or set ParameterCondition/JpqlCondition#skipNullOrEmpty = true to return old behaviour for particular condition.
dtaimanov
changed the title
Jmix Data Repository ignores nulls in parameters
Conditnion improvements: support null params, support by Jmix Data Repositories
Feb 9, 2024
dtaimanov
changed the title
Conditnion improvements: support null params, support by Jmix Data Repositories
Condition improvements: support null params, support by Jmix Data Repositories
Feb 9, 2024
dtaimanov
changed the title
Condition improvements: support null params, support by Jmix Data Repositories
Condition improvements: support null params, support in Jmix Data Repositories
Feb 9, 2024
I. Support conditions in Jmix Data Repositories
io.jmix.core.repository.JmixDataRepositoryContext
has been added to passio.jmix.core.querycondition.Condition
and other Jmix-related paramters to Jmix Data Repositories. It allows to dynamically change them at runtime for repository methods.Implementation:
io.jmix.core.repository.JmixDataRepository
standard methods.Priorities of parameter values (from highest to lowest):
FetchPlan:
FetchPlan
parameterJmixDataRepositoryContext#fetchPlan
parameter@FetchPlan
annotatin valueHints (different keys will be merged, the same key value will be overridden):
JmixDataRepositoryContext
parameter@QueryHints
annotation valueII. Do not ignore conditions if parameter is null or empty:
See forum topic
Problem:
Jmix Data Repositories use
io.jmix.core.querycondition.Condition
under the hood.Condition
originally have been designed to work with UI filter conditions where null value in field means that no filtering needed because value is not specified.Unfortunately this is not correct behaviour for Data Repositories.
Solution:
Rework Conditions and Repositories in order to take nulls as parameters
Implementation:
jmix.core.skip-null-or-empty-conditions-by-default=true
to return old behaviour for projectSet
jmix.core.skip-null-or-empty-conditions-by-default=true
to return old behaviour for all project or setParameterCondition/JpqlCondition#skipNullOrEmpty = true
to return old behaviour for particular condition.Studio issue: JST-4693
QA Notes
I. Support conditions in Jmix Data Repositories
II. Do not ignore conditions if parameter is null or empty
jmix.core.skip-null-or-empty-conditions-by-default
toggles this behaviourjmix.core.skip-null-or-empty-conditions-by-default=true
The text was updated successfully, but these errors were encountered: