Interface EntityQueryModel.SelectAttributes
- Enclosing interface:
EntityQueryModel
The final set of attributes is computed as: (defaults ∪ included) \ excluded
Provides runtime configuration of which attributes to load:
defaults()- Override the base set of attributes (normally those with.selected(true))include()- Add attributes beyond the defaults (e.g., lazy-loaded columns)exclude()- Remove attributes from the final set
-
Method Summary
Modifier and TypeMethodDescriptiondefaults()Returns theValueSetcontrolling the default attributes to use as the base set when querying entities.exclude()Returns theValueSetcontrolling attributes to exclude when querying entities.include()Returns theValueSetcontrolling additional attributes to include when querying entities, beyond the default selected attributes.
-
Method Details
-
defaults
Returns theValueSetcontrolling the default attributes to use as the base set when querying entities.When empty, the entity definition's default selected attributes (those marked with
.selected(true)) are used. When non-empty, these attributes completely replace the entity definition defaults.This allows complete control over the base attribute set, rather than just adding to or removing from defaults.
The final attribute set is:
(defaults ∪ included) \ excluded// Replace defaults with a minimal set EntityQueryModel queryModel = tableModel.queryModel(); queryModel.attributes().defaults().set(Employee.ID, Employee.NAME); tableModel.items().refresh(); // Revert to entity definition defaults queryModel.attributes().defaults().clear(); tableModel.items().refresh();- Returns:
- the
ValueSetcontrolling the default base attributes - See Also:
-
include
Returns theValueSetcontrolling additional attributes to include when querying entities, beyond the default selected attributes.An empty
ValueSetmeans no additional attributes will be included - only the defaults (those marked with.selected(true)) will be loaded.This is particularly useful for including lazy-loaded attributes on-demand without having to replace the entire default attribute set.
The final attribute set is:
(defaults ∪ included) \ excluded// Include a lazy blob column on-demand EntityQueryModel queryModel = tableModel.queryModel(); queryModel.attributes().include().add(Country.FLAG); tableModel.items().refresh(); // Remove the lazy attribute queryModel.attributes().include().remove(Country.FLAG); tableModel.items().refresh();- Returns:
- the
ValueSetcontrolling additional attributes to include - See Also:
-
exclude
Returns theValueSetcontrolling attributes to exclude when querying entities.These attributes are removed from the final set after applying defaults and
include().Note that primary key attributes are always included regardless of exclusions, and attributes required by included foreign keys cannot be excluded.
The final attribute set is:
(defaults ∪ included) \ excluded// Exclude expensive computed columns EntityQueryModel queryModel = tableModel.queryModel(); queryModel.attributes().exclude().add(Employee.COMPUTED_BONUS); tableModel.items().refresh(); // Re-include the column queryModel.attributes().exclude().remove(Employee.COMPUTED_BONUS); tableModel.items().refresh();- Returns:
- the
ValueSetcontrolling attributes to exclude - See Also:
-