Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes legacy app and hibernate app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "legacy app and hibernate app " Watch "legacy app and hibernate app " New topic

legacy app and hibernate app

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
We have a web service we are implementing that is going to have to participate in global transactions with the client. For our Hibernate/Spring apps where we use @Transactional, this is not a problem. However, we have at least two legacy applications using bare bones JDBC. They are large enough that retrofitting is not viable in the near term, yet they must talk to this web service and participate in the two-phase commit.

We were hoping we could distribute a jar with the web service client in it that would expose a method that would take the JDBC connection, hook it into an @Transactional boundary, do some work, including calling the web service, and be able to have it use the connection provided from the legacy app. In other words, we need a way to hand a particular connection, upon which a transaction has already started, to the @Transactional instead of the one it would naturally allocate. And obviously it could not commit when it leaves since the legacy app does the commiting.

Does anyone have the faintest idea of how to pull this off?
Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
I gather that TransactionAwareDataSourceProxy seems to be intended for this use, but I see no examples. I just see people saying that this (integrating legacy JDBC and JTA) is what it is for.

It feels like I should somehow start the JTA transaction outside the method and not use the annotation. If the connection is in the session, bound to the thread and transactions started, then everything should pick up automagically right? But if so, I am not sure how to do that.
I agree. Here's the link:
subject: legacy app and hibernate app
Similar Threads
Understanding JTA internals
Help understanding JEE containers for design decission
Legacy Connectivity ....thanx John and Amanda
JCA resource Adapter and Web Services
Where can I find John Wetherbie note on Legacy Connectivity