Originally posted by ravi inguva:
can you please tell me the better way of rolling back all the records
the two ways i know is
1. ebjcontext.setrollbackonly and
2. throwing a new system exception
can somebody guide me how to handle this situation for rolling back.
That's it. What is it that you find inadequate about either of those choices for rolling back a transaction?
Of course, for the rollback to work the way you intend, the transactional attributes will need to be properly set on your Entity Beans. In other words, all of your Entity Bean interaction needs to take place in the context of the same transaction.
In this case
you should mark your Entity Beans with the transactional attribute "Required" and mark your Session Bean with "RequiresNew". In general I usually mark Entity Beans as "Required" unless they are Read-Only in which case I mark them as "NotSupported".
If properly configured, you should only have to rollback from your Session Bean in order to rollback all the Entity Bean interactions.