LookupField annotation#5459
Open
knstvk wants to merge 4 commits into
Open
Conversation
glebfox
approved these changes
Jul 17, 2026
| * query conditions built from the instance-name metadata of the referenced entity. If neither | ||
| * is set, items are loaded eagerly. | ||
| */ | ||
| @Target({}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Declarative, data-model-level control over the UI component Jmix generates for entity reference attributes: an
EntityComboBox(dropdown) or anEntityPicker(view lookup), the actions on it, and optional opt-in lazy loading of dropdown items. Restores the CUBA@Lookupcapability dropped in the Jmix migration and extends it with lazy loading that works for any data store, including non-persistent DTO entities. Applications using no annotation are unaffected — the no-annotation code paths are unchanged.What's included
jmix-core,io.jmix.core.entity.annotation):@LookupField(targetable at a class or a reference field),@LookupItemsQuery(explicit JPQLqueryorbyInstanceName), and theLookupTypeenum (DROPDOWN/VIEW).jmix-flowui):LookupFieldSupport+EffectiveLookupConfig— one source of truth for precedence (field annotation →entity-field-*properties → class annotation) and validation. Consumed by both generators.EntityFieldCreationSupportbuilds the picker/combobox and its lazy items callbacks; the items-fetch logic lives in the sharedItemsFetchCallbackSupport.ComponentXmlFactory. Eager dropdowns render as true eager comboboxes backed by a generated data container; explicit-query andbyInstanceNamedropdowns render as lazy<itemsQuery>.byInstanceNameis now expressible directly in a hand-written<entityComboBox><itemsQuery>, with design-time Studio metadata for the attribute.Behavior
querywith:searchString, orbyInstanceName(query conditions over the instance-name attributes; works for any store). Items load throughDataManager, so row-level security applies.Compatibility
Breaking on the protected/internal surface only (all within
*Supportextension points):EntityFieldCreationSupportprecedence internals moved toLookupFieldSupport;DataLoaderSupport.getSearchString/VALUE_PARAMETERremoved; instance-name helpers moved toItemsFetchCallbackSupport; several bean constructors gained parameters. No released public API is affected.Testing
Spock integration tests (in-memory HSQL) over resolver precedence/validation, live-component generation, the XML
byInstanceNameloader, template XML generation with degradation, and an end-to-end template render.Follow-ups (non-blocking)
@LookupFieldwhen generating views.@LookupFieldmeta-annotation in Dynamic Model. May require changes in the way the metadata store nested annotations like@LookupItemsQuery(currently they are stored as Java annotation objects).