dimanche 29 mars 2015

How to embed spring declarative JPA transaction inside a legacy non managed and jdbc based code

We have a legacy web application using plain JDBC connection and not being spring managed. We are currently moving to a full spring/JPA managed application.


Currently legacy application is calling spring beans. Spring beans are correctly marked with @Transactional. The legacy application runs behind an OpenEntityManagerInViewFilter.


Use case



  1. Legacy App opens JDBC connection

  2. Legacy App applies an update with JDBC connection without committing

  3. Legacy App calls a spring bean method annotated @Transactional

  4. On method end, Spring commits

  5. Legacy app cannot rollback the first update


How can I start a Transaction in the legacy app, that will be joined by @Transactional in order to avoid unwanted commit?


Aucun commentaire:

Enregistrer un commentaire