Hi, in Jmix 2.0 I have an entity (“Person”) with a variable Author which has a FK to a Person itself.
In the detail view of a Person I want to show the name and the surname of the Person related to the Author of the main Person.
I did achive that but the query applies a correct JOIN on the table Author but not to the Person related to the author. Instead it performs a separated query by ID and I need to prevent that.
In the entity Author:
@InstanceName
@DependsOnProperties({"person"})
public String getInstanceName(){
return person.getInstanceName();
}
In the entity Person:
@InstanceName
@DependsOnProperties({"surname", "name"})
public String getInstanceName(){
if(surname!=null && name!=null) {
return surname + " " + name;
}
return null;
}
In the fetch plan tag of the detail view I tried both
<property name="autore" fetch="JOIN" fetchPlan="_instance_name"/>
and
<property name="autore" fetch="JOIN" fetchPlan="_base"/>
but the result is the same.
Thank you in advance.