Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

legacy app and hibernate app

 
Brian Mulholland
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic