posted 17 years ago
Hi
I've a session bean to compute and create complex report. It stores data in 3 tables, and should be completely rolled back when any exception occurs. It's sth like this:
public void createReport() {
reportId = reportEntityBean.create(...).getReportId();
for(...)
createSubReport(reportId, ...); /* invokes some calculations and subreportEntityBean.create(reportId, ...); */
for(...)
createReportItem(reportId, ...); /* invokes some calculations and reportItemEntityBean.create(reportId, ...); */
checkIsValid();
}
Ok, this code if everything is ok, should create entities in 3 tables. But I want also everything to be rolledback if any exception in this method or methods invoked by it occurs. For example, if report entity is already create and exception in subreportEntintyBean.create method is raised, I want to remove created report. Unfortunately it's not working as expected. In ejb-jar.xml I have set attributes of the methods:
createReport as Required
createSubReport, createReportItem, checkIsValid as Required (also tried with Mandatory)
please help.