Skip to content

fix: share one connection between Hibernate and JDBC DHIS2-22067 [43] - #25070

Merged
teleivo merged 1 commit into
2.43from
DHIS2-22067-43
Sep 9, 2026
Merged

fix: share one connection between Hibernate and JDBC DHIS2-22067 [43]#25070
teleivo merged 1 commit into
2.43from
DHIS2-22067-43

Conversation

@teleivo

@teleivo teleivo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

backport of #25041

)

JpaTransactionManager was created without a DataSource, so Spring never
registered a ConnectionHolder under the DataSource key. Every
@transactional method mixing Hibernate and a plain JdbcTemplate took a
second connection from the same pool which was not enlisted in the
transaction: its statements commit immediately and a rollback does not
cover them.

This is why the org unit merge can destroy data. Its JDBC deletes of
datavalue and dataapproval commit as they run, so a later failure rolls
back the Hibernate work while the deleted rows stay gone.

Introduced in 2.41 by 6eb421d (#14626,
TECH-1517), which swapped HibernateTransactionManager for
JpaTransactionManager and dropped its setDataSource call.
@teleivo
teleivo requested review from a team and jbee September 8, 2026 13:20
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@teleivo
teleivo merged commit 090c1f2 into 2.43 Sep 9, 2026
18 checks passed
@teleivo
teleivo deleted the DHIS2-22067-43 branch September 9, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants