I have an Entity TObject with an association to an Entity TContact (objEventIdContact) and to an Entity TSite(objSiteIdSite).
From the descriptor
<data>
<collection id="tObjectsDc" class="org.biooffice.bio4.entity.TObject">
<fetchPlan extends="_base">
<property name="objDetIdContact" fetchPlan="_instance_name"/>
<property name="objEventIdContact" fetchPlan="_local"/>
<property name="objSiteIdSite" fetchPlan="_local"/>
</fetchPlan>
<loader id="tObjectsDl" readOnly="false">
<query>
<![CDATA[select e from TObject e order by e.objCommonDescription]]>
</query>
</loader>
</collection>
<dataGrid id="tObjectsDataGrid" dataContainer="tObjectsDc" columnReorderingAllowed="true"
multiSort="true" multiSortPriority="APPEND" selectionMode="MULTI"
themeNames="row-stripes, compact, no-border, no-row-borders">
In the controller I use uiReportRunner
Set<TObject> tObjects = tObjectsDataGrid.getSelectedItems();
uiReportRunner.byReportEntity(report)
.withOutputType(ReportOutputType.PDF)
.withParametersDialogShowMode(ParametersDialogShowMode.NO)
.addParam("Obj", tObjects)
.addParam(JRParameter.REPORT_LOCALE, getLocale())
.runAndShow();
In the band of the report I have
def result = []
def tObjects = params['Obj'];
tObjects.each(
tObject-> {
def sitCountry = "";
if ( tObject.objSiteIdSite != null ) {
sitCountry = tObject.objSiteIdSite.sitCountry;
}
def SammlerName = "";
if ( tObject.objEventIdContact != null ) {
SammlerName = tObject.objEventIdContact.conLastName;
}
result.add([
'sitCountry' : sitCountry,
'SammlerName' : SammlerName
]
);
}
);
return result;
If I execute this report, the sitCountry from TSite (objSiteIdSite) is found and printed, but if I want to assign the conLastName from TContact (objEventIdContact), I get the following error
> io.jmix.reports.exception.ReportingException: An error occurred while loading data for band [Detail] and query [dataSet1]. Report name [Objekte 40x13 mm Etiketten]
> An error occurred while loading data for data set [dataSet1]
> Cannot get unfetched attribute [conLastName] from detached object org.biooffice.bio4.entity.TContact-1891 [detached].
What can I do ?
The association to objSiteIdSite is fetched, but the association to objEventIdContact not ?
How to force the fetching of the TContact Entity ?
Best regards
Felix