Postgres SQL does not support 'true' XA behavior. Certain aspects of JTA interaction with the TM (such as suspend/resume) are not available. Were you informed of something different? Could you post your ds-xml files?
Sure, is here:
I'm using PostgreSQL JDBC 3 Driver with PostgreSQL 8.1. In PostgreSQL site says that supports XA. Is not full suport? I can't use this database for this Task?
No, it's not full suppport. The driver doesn't support transaction interleaving, as well as the stop/resume portions of the protocol. The developer of the XA functionality remarks on this in a variety of areas in the driver.
Could you describe a bit more about the behavior you are seeing, as well as the transactional attributes of your EJB's?
I am not sure if I understand what exactly the problem is.
I have two enterprise applications (App1 and App2). All EJBs are Container Managed Transaction with transction attribute required.
App1 and App2 are connected with the same database across different datasources (DataSource1 and DataSource2). My problem is:
In the database I have two tables: TABLE1 and TABLE2. TABLE2 have a foreign key for TABLE1. My problem is:
When a EJB in App1 execute, it insert one row with TABLE 1. Inside EJB in App1 I call one EJB in App2, then EJB in App2 try to insert one row in TABLE2 with the foreign key id generated by App1.
I think that when I call EJB in App2 the transaction context is propagated. Is the same transaction because EJB in App2 are with transaction attribute required. But, looks like two database transactions, the data inserted by EJB in App1 are isolated to EJB in App2.
Then, the EJB in App2 throws an error: Foreign key constraint violation, because it can no see the data inserted by EJB 1 in the same XA Transaction but in different datasource.
Since the data in Table1 effectively doesn't exist until the COMMIT, this is not going to work. Transaction isolation levels will prevent this regardless of whether or not they are in the same transactions.
Do you actually want to implement something like this, or is this just a test scenario for you?
Easiest solution would be the demarcate each EJB method with boundaries such as REQUIRES_NEW. Let the first transaction complete and then insert the second value.