aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Transaction propagated from JTA to CMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Transaction propagated from JTA to CMT" Watch "Transaction propagated from JTA to CMT" New topic
Author

Transaction propagated from JTA to CMT

Solo Chiang
Greenhorn

Joined: Sep 14, 2005
Posts: 18
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 ]
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Solo,

My thoughts...

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.


Shailesh Kini.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction propagated from JTA to CMT