persistence-unit

multiple persistence unit on same transaction


I'm trying to implement a transaction with 2 different database.
I currently have a persistence unit for each database, and wanted to write on a table A that exists on schema SA and write on a table B on schema SB, on the same transaction.

I'm using weblogic and eclipselink.

I've search a little, but found no example of using multiple persistence units on the same transaction.

Can someone tell me the correct way of doing this?

thank you


Solution

  • Found out that, this should be implemented using XA datasources.
    Each persistence unit should use a XA datasource, and then take part on a two-phase commit.

    I now have: