• Post Reply Bookmark Topic Watch Topic
  • New Topic

entity ejb cmt and datasource question.  RSS feed

 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use Entity bean CMP+CMT, is it a must that the datasource that i employ has to be XA Aware? I ran into this statement somwhere and am not sure why my DS has to be XA Aware if I dont have distributed Txns in the system. Can somebody confirm?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,
Yes it does. The reason is that very often multiple EJBs are enlisted in the same transaction. If your DataSource is non-TX then this is going to work if and only if all participants will share the same phisical databse connection. This basically means that you have to programm your EJBs accordingly and to pass the same database connection from one bean to another. As with most of the EJBs one usually gets a new connection from the pool for every method call. In theory at least, using CMT should also imply that (for optimization reasons) the container will reuse the same connection throughout the entire transaction. In practice though it�s probably not going to work. However WebLogic will allow you setting TX-DataSources pretty easily, just enabling the Honor Global Transactions when defining the DataSource. There are several reasons that might enforce your app to use non-TX drivers (when the underlying database doesn�t support distributed transactions, for example), but this should not be the case for any EJB applications.
Regards.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Valentin!

Originally posted by Valentin Tanase:

If your DataSource is non-TX then this is going to work if and only if all participants will share the same phisical databse connection.


I assume you meant 'non XA Aware' and not 'non - TX'. Is that correct?


This basically means that you have to programm your EJBs accordingly and to pass the same database connection from one bean to another.


So an XA Aware DS makes sure that the same connection is passed on to each of the EJBs enlisted in a single transaction? or it does somethin totally different that doesnt require the use of a single connection object across the single transaction?.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,

I assume you meant 'non XA Aware' and not 'non - TX'. Is that correct?

That�s correct.

So an XA Aware DS makes sure that the same connection is passed on to each of the EJBs enlisted in a single transaction? or it does somethin totally different that doesnt require the use of a single connection object across the single transaction?.

It basically allows multiple connections to be enlisted in the same transaction.
Regards.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!