Hi,
I am calling below piece of code from onBeforeCommitChanges event by passing Invoice entity which is not yet saved in DB.
Unable to generate the report with error - Caused by: com.haulmont.cuba.core.global.EntityAccessException: Unable to load entity bpd_Invoice-9d2ce31c-bf24-4766-d6c6-65c02da21ef6 because it has been deleted or access denied
at com.haulmont.cuba.core.app.DataManagerBean.reload(DataManagerBean.java:118) ~[cuba-core-7.2.16.jar:7.2.16]
Any help will be appreciated.
Source Code:
@Override
public void generateReport(String invoiceId, String fileName,Invoice invoice) {
try{
Report report = dataService.load(
LoadContext.create(Report.class).setQuery(
LoadContext.createQuery("select e from report$Report e where e.code = :reportCode")
.setParameter("reportCode", INVOICE_REPORT_CODE)
)
);
Map<String, Object> params = ParamsMap.of("entity", invoice);
FileDescriptor reportFileDescriptor = reportService.createAndSaveReport(report, params, fileName);
logger.info("reportFileDescriptor::"+reportFileDescriptor);
}catch(Exception e){
logger.error("Exception from generateSPInvoice::",e);
}
}