JTA or transaction-api (openldap and mongodb)

313 views Asked by At

I would like to join two operations in one transaction.

Operations->

Op. 1/ I need to save a user on a mongodb database. I'm using this library in order to persist data on this database. After that, ...

Op. 2/ I need to save some of this user information on a openldap server. I'm using this library in order to connect with a openldap instance.

So, as you might be figuring out, I need to ensure both operations has been performem well.

So,

1) Operation 1:ok, and 2nd:ok have been right -> No problem -> Tx.commit();

2) Operation 1:ok, and 2nd:ko -> Problem -> I need to rollback first operation. -> Tx.rollback();

3) Operation 1:ko -> Tx.rollback();

The environtment of these operations are inside a Servlet in a J2EE Servlet Container 3.1.

I have no idea how to do that.

0

There are 0 answers