XA transactions and deferred constraints

Derby defines how some XAResource methods behave in conjunction with deferred constraints.

If an application calls XAResource.prepare(Xid), any constraints with a constraint mode of DEFERRED are checked. If there is a violation, Derby throws XAException.XA_RBINTEGRITY, and the XA transaction is rolled back.

If an application calls XAResource.commit(Xid, true) (with true indicating a one-phase commit), any constraints with a constraint mode of DEFERRED are checked. If there is a violation, Derby throws XAException.XA_RBINTEGRITY, and the XA transaction is rolled back.

See CONSTRAINT clause and SET CONSTRAINTS statement for more information about deferrable constraints.

Related reference
Recovered global transactions
XAConnections, user names and passwords