A common use case when working against LDAP is that some of the data is stored in the LDAP tree, but other data is stored in a relational database. In this case, transaction support becomes even more important, since the update of the different resources should be synchronized.
While actual XA transactions is not supported, support is provided to conceptually wrap JDBC and LDAP
access within the same transaction using the ContextSourceAndDataSourceTransactionManager
.
A DataSource
and a ContextSource
is supplied to the
ContextSourceAndDataSourceTransactionManager
, which will then manage the two transactions,
virtually as if they were one. When performing a commit, the LDAP part of the operation will always
be performed first, allowing both transactions to be rolled back should the LDAP commit fail. The JDBC
part of the transaction is managed exactly as in DataSourceTransactionManager
, except that
nested transactions is not supported.