aspose file tools*
The moose likes Web Services and the fly likes REST and JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST and JPA" Watch "REST and JPA" New topic
Author

REST and JPA

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
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.
Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REST and JPA