HI, Im using java ee 5. i want to send database inserts to the database throught a message queue to ensure the order of insertions.
clients invokes a stateful session bean to send the data. and the bean will access the message driven bean which is responsible for the actual db insert. all the calls through a single stateful bean is in one transaction. if one of the inserts fail the transaction should rollback.
but the problem im facing here is the SQL connection used to the updates cannot be passed from the session bean to the message driven bean since the conncetion is not serializable.
Can any one help me with a solution to this problem.
I do believe that you must be doing your business implementation in this way
1. From stateful session bean you are just calling message driven bean and in MDB using entity manager(or datasource) you are inserting new values to DB. 2. For updation same way you are folowing...
Well, if you are invoking entity manager(or by datasource) through MDB then i dont believe there is any problem because i hope you are making you business method's with MANADATORY transaction attribute there itself... If you are following above then i dont see you have to pass sql connection to MDB because you are creating it in MDB itself.
So just do DB specific operation(invocation of SQL connection,create,update,delete operation) in MDB and let the session bean talk to MDB..
Do let me know if i have got to your point or you can post your code snippet so that i can have a look on it.
If at first you don't succeed, don't try skydiving
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop