Unfetched attribute error when loading an instance name in case of entities hierarchy #2860
Labels
candidate
Possible candidate for future releases
in: core
in: flowui
size: M
type: bug
Something isn't working
Environment
Jmix version: 2.1.3
Bug Description
Let's say that we have a
Pet
entity:It has a descendant class:
Dog's instance name contains attribute that is not present in Pet.
The
Appointment
entity has a reference toPet
:The problem is that when we load a list of appointments in the appointments list view the error appears:
IllegalStateException: Cannot get unfetched attribute [dogName] from detached object com.company.instancenameissue.entity.Dog-31fd51d1-b51f-1c7c-459e-a4fb4275a224 [detached].
Fetch plan for
Appointment
contains aPet
attribute (it doesn't contain adogName
flield that is used by dog instance name). But the screen tries to evaluate an actual instance name (for Dog) instead of evaluating instance name for Pet.The solution may be to introduce a new method in the
InstanceNameProvider
that in addition to entity instance will accept the class that should be used for instance name evaluation (we would passPet.class
there). This new method should be somehow used by Jmix dataGrids and other components.Sample Project
instanceNameIssue.zip
The text was updated successfully, but these errors were encountered: