My project is writing REST services for the first time, and we have one that we'd like to participate in the transaction to the database of the caller. We thought for sure that was impossible, but with some internet searching, we think we might be wrong about this. Can anyone explain in brevity how this works? How can REST participate in a JPA transaction? I am slogging through some of the documentation, but I find that i am having a forest for the trees effect. None of them seem good at getting to the point.
Joined: Mar 12, 2009
To be more clear, the situation is that a regular database transaction might be happening in the client, it calls one or more RESTful services, if any fail, I need all to rollback, just like a regular transaction. We assumed that this could not happen, that we'd have to accept that there would be no way to make REST act as a particpant in a transaction other than just testing returns and rolling back the parent and reconciling that rollback against other sources in code.
Then one developer saw this JEST stuff (OpenJPA and REST) and we thought that seemed to be the answer. So I am trying to find out definitely if it is possible. Can a REST service act as a participant in a transaction? If so how. I am wondering if JEST is actually just implementing the transaciton WITHING the service, not making the service a particpant within the transaction. Or if there are other ways to accomplish the goal.