Package io.jmix.core.entity.annotation
Annotation Interface LookupItemsQuery
Configures lazy loading of drop-down items for
LookupField with
LookupType.DROPDOWN. Usable only as the LookupField.itemsQuery() member.
Either set an explicit query(), or set byInstanceName() to match items by
query conditions built from the instance-name metadata of the referenced entity. If neither
is set, items are loaded eagerly.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIf true, drop-down items are matched by query conditions (Condition) built from the instance-name metadata of the referenced entity: string-typed instance-name-related attributes are matched with a case-insensitivecontainscondition, combined withorif there are several.booleanWhether to escape the user input for use in alikeclause.Name of a fetch plan of the referenced entity to load items with.JPQL query with a mandatory:searchStringparameter, for example:Format of the:searchStringparameter value with the${inputString}placeholder for the user input, for example"(?i)%${inputString}%".
-
Element Details
-
byInstanceName
boolean byInstanceNameIf true, drop-down items are matched by query conditions (Condition) built from the instance-name metadata of the referenced entity: string-typed instance-name-related attributes are matched with a case-insensitivecontainscondition, combined withorif there are several. Works with any data store capable of loading instances, including non-persistent DTO entities in custom stores. Mutually exclusive with an explicitquery()— if both are set, the explicit query wins and a warning is logged.searchStringFormat()andescapeValueForLike()do not apply in this mode: matching is always a case-insensitive substring search with the value escaped for the underlyinglike.- Default:
false
-
query
String queryJPQL query with a mandatory:searchStringparameter, for example:select e from Customer e where e.name like :searchString escape '\\' order by e.name
Empty string means "not set". Applies only whenbyInstanceName()is false.- Default:
""
-
searchStringFormat
String searchStringFormatFormat of the:searchStringparameter value with the${inputString}placeholder for the user input, for example"(?i)%${inputString}%". Empty string means "not set" (raw user input is used). Applies to the explicitquery()only; if set together withbyInstanceName(), it is ignored and a warning is logged.- Default:
""
-
escapeValueForLike
boolean escapeValueForLikeWhether to escape the user input for use in alikeclause. The query must then contain the matchingescape '\\'clause. Applies to the explicitquery()only; ignored (silently) whenbyInstanceName()is true, where escaping is always on.- Default:
false
-
fetchPlan
String fetchPlanName of a fetch plan of the referenced entity to load items with. Empty string means "not set" (default is the loader's default fetch plan with an explicit query;_instance_namewithbyInstanceName()).- Default:
""
-