Here is my question, I am trying to have a transaction propagated from JTA to CMT, will it work?
I have two entity beans adopted CMT for one of its business method. I have a Struts Action class that will call these two entity bean one by one for two database update respectively.
In order to put these two database changes into a single transaction, can I use JTA (ut.begin() & ut.commit()) to enclose two method invocation for these two entity bean and specify transaction attribute as "Required" in these two business method to achieve my goal? [ October 12, 2007: Message edited by: Solo Chiang ]
Yes, the EJB container supports JTA by default... at least from J2EE 1.4 not sure about earlier versions. You do not have to call ut.begin() or ut.commit() manully. You can have the container manage it for you.
However by default your JDBC Datasource does not participate in XA so you have to change the JDBC datasource interface from javax.sql.DataSource to javax.sql.XADatasource for both the datasources.
Your session bean will have a Required attribute and so will your entities.