I am new to EJB 3.0.I have one db2 database and 3 as400 databases. when I create a new record in one of the db2 table(db2 database),I have to create the same record in 3 as400 table(3 seperate as400 databases).This has to happen in one transaction.whenever something any of the insert fails I need to rollback everything. I use ejb 3.0 session bean(business layer) and JPA(OR mapping).
I created 4 ejb projects.I created 4 seperate persistence units for each databases.I am planning to call my main method from from first EJB project Session bean and within that I planning to use 4 methods to insert into didfferent databses.
insert mthod1 ===> to insert DB2 table
insert method2 ===> call remotely EjbProject2 session bean method to insert to As400 database1
insert method3 ===> call remotely EjbProject3 session bean method to insert to As400 database3
insert method4 ===> call remotely EjbProject4 session bean method to insert to As400 database4 }
all these should be part of one transation.
I do not know whether it is going to work or not? any body has any idea? Anybody has example that deals with multiple databases or how distributed transaction work with multiple databsaes in EJB 3.0?