Hi all,

I'm working on an Online Order Processing system. One of the functionalities that we've developed is mass order upload, that consists of one CSV file with a lot of orders inside.
To have concurrent processing on the processing of an order upload file (as the orders present in file are independent of each), we've implemented a Message Driven Bean that receives an order to process in a request queue, processes the order and answers with the processed order in a response queue. The flow is like:
1- Struts action is invoked to handle order upload.
2- A method on a session bean is called to process the file.
3- The session bean parses the file, separates all the order lines by origin customer (one order for each customer in the file) and sends messages to the request queue.
4- For each order, an instance of the MDB will receive the message, process the order and send the processed order via response queue.
5- After the Session Bean sends all the requests with the orders to process, he will wait for all the responses in the response queue until all the orders are processed and provide a valid answer, according to the whole process result, to the online user.

My doubt is how can I manage efficiently transactions (mostly database transactions) so if inside a bunch of 200 orders processed concurrently one fails, I am able to rollback all the database transactions used by the MDB to process all the orders?
As the failure of an order can be related to some error in the file, I want to rollback everything, give a message to the user to fix the file and allow him to upload the whole file (fixed) again.

Any help would be appreciated.

Regards,
Campos