Different behaviour with Jmix 2.7.x in reporting

Hi Everybody

Until Jmix 2.7.x the following groovy script did work

import org.biooffice.bio4.entity.TLoanItem

def result = [];

def posList = dataManager.load(TLoanItem)
                .query("e.ltmIdLoan = ?1", params['Loan'])
                .list();
                
posList.each(
    pos->{
        result.add([
            'objStorageNumber'   : pos.ltmIdObject.objStorageNumber,
            'taxTaxonDisplay'    : pos.ltmIdObject.objDetIdTaxon.taxTaxonDisplay,
            'taxTaxonCommonName' : pos.ltmIdObject.objDetIdTaxon.taxTaxonCommonName,
            'objStorageLevel4'   : pos.ltmIdObject.objStorageLevel4,
            'ltmDateInPlanned'   : pos.ltmDateInPlanned
            ])
    }
);

return result;

Since version 2.7.x I get an error

ReportingException: An error occurred while loading data for band [Data] and query [dataSet1]. Report name [Leihschein]
An error occurred while loading data for data set [dataSet1]
Cannot get unfetched attribute [objDetIdTaxon] from detached object org.biooffice.bio4.entity.TObject-26160 [detached].

There are now several solutions to resolve this.

Why did it work before 2.7.x ?

What is the best way to handle this case after 2.7.x ?

Thank you

Best regards

Felix

Hello,

I don’t know why it worked before, but
“Cannot get unfetched attribute [objDetIdTaxon] from detached object” basically says that you need to adjust your fetch plan, or query the value yourself.

Kind regards,
Mladen

Hi @mbucan

We have the same state :wink:

I know it is unfetched and I would like understand, how in Jmix 2.6 this was working !

I have a lot of reports which I have to check and to adapt. Before I now fetch everything piece by piece, I would like to know why it did work before to go to that point and adjust it on that central point.

I think, just with the import org.biooffice.bio4.entity.TLoanItem there is no fetchplan, correct ?

Kind regards
Felix