Hi everyone,
I would like to know best way to solve this problem, I have 3 entities:
Ticket (has 0 to many) Activities (has 0 to one) Appointment. I manage this structure with composition relationship because is helpful, but I have a User Experience problem about chain saving entities
There is a way to make persitence Appointment also if it been generated or edited from a chain of composition entities? I would like that if I create a ticket, I create an activity and I save it also ticket became saved and I’ll back in ticket browser I don’t need to save ticket(parent entity), the same for appointment
So the problem is that I not really save Appointment or Activities until I had save Ticket, and this is reflected also in report, that I get old entities if I try to pass to report getEditEntity().
for example, if I modify event opened by Activity.edit and I try to print it I obtain the old values on report, until I had saved Activity and Ticket, after that I find new values in Appointment
Map<String, Object> reportParams = new HashMap<>();
reportParams.put("entity", getEditedEntity());
Report report = dataManager.load(Report.class)
.query("select r from report$Report r where r.code = 'AppointmentReport'")
.optional().orElse(null);
if (Objects.nonNull(report)) {
//reportGuiManager.printReport(report, reportParams);
ReportOutputDocument reportResult = reportGuiManager.getReportResult(report, reportParams, null);
exportDisplay.show(new ByteArrayDataProvider(reportResult.getContent()), reportResult.getDocumentName());
}
To save the entities I use
<button id="commitAndCloseBtn" action="windowCommit"/>
because user doesn’t like to come back to previous page after save.
Ticket
----> 0…* Activities
----> 0…1 Appoitment
Thanks