You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by chintan4181 <ch...@gmail.com> on 2011/05/25 18:38:06 UTC

XA Transaction query

Hi,

Our application will be interacting with two different databases. DB2 and
SQL Server. we have configured XA datasource in application server. I need
to understand how can i implement XA Transaction using JPA/OpenJPA.

My understanding is, since we are using CMT, we should not bother about
writing any XA transaction management code. Please confirm. Also how JPA
will handle XA transaction when i use two persistent units in same
transaction? do i need any configuration?

Please advice.

Thanks
Chintan

--
View this message in context: http://openjpa.208410.n2.nabble.com/XA-Transaction-query-tp6403526p6403526.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: XA Transaction query

Posted by chintan4181 <ch...@gmail.com>.
Thanks Kevin. I do have both points mentioned by you

--
View this message in context: http://openjpa.208410.n2.nabble.com/XA-Transaction-query-tp6403526p6404224.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: XA Transaction query

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Chintan,
As long as you are using CMT, you only have to ensure a couple of items in
your persistence.xml and you should be good to go.

1)  The transaction-type should be set to "JTA" in your <persistence-unit>
configuration.  This is the default value, so as long as you are using this
persistence-unit in a managed environment, you should be set.

2)  Use a <jta-data-source> element to define your datasource usage.

A good, easy to read reference for general JPA questions like this is the
Pro JPA 2 book by Mike Keith and Merrick Schincariol [1].

Good luck,
Kevin

[1]
http://www.amazon.com/Pro-JPA-Mastering-Persistence-Technology/dp/1430219564

On Wed, May 25, 2011 at 11:38 AM, chintan4181 <ch...@gmail.com> wrote:

> Hi,
>
> Our application will be interacting with two different databases. DB2 and
> SQL Server. we have configured XA datasource in application server. I need
> to understand how can i implement XA Transaction using JPA/OpenJPA.
>
> My understanding is, since we are using CMT, we should not bother about
> writing any XA transaction management code. Please confirm. Also how JPA
> will handle XA transaction when i use two persistent units in same
> transaction? do i need any configuration?
>
> Please advice.
>
> Thanks
> Chintan
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/XA-Transaction-query-tp6403526p6403526.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>