Skip to content

Make JpaVendorAdapters JTA-aware (in particular for Hibernate 5.1/5.2) [SPR-16162] #20710

Closed
@spring-projects-issues

Description

@spring-projects-issues

Alexandru-Constantin Bledea opened SPR-16162 and commented

One case that I keep coming across every once in a while is the issue that was described in #19524.

So I basically want to reopen that case but with an improvement suggestion rather than a bug report.

The problem as described there was that "The underlying technical problem is that we can't influence Hibernate's connection release mode depending on the transaction setup: simply because JPA doesn't allow us to reliably introspect the transaction setup in general."

I've dug a bit into this and I'm wondering why we need to know the transaction manager at the point of creating the JpaVendorAdapter? The JpaVendorAdapter is only used for the EntityManagerFactory and when we are building the EntityManagerFactory we do know what transaction type we will be using. This information is available from the JPA PersistenceUnitInfo.

I'm thinking if it would make sense to add an additional method to JpaVendorAdapter, something like, getAdditionalJpaPropertiesMapByTransactionType() that is called after the default getJpaPropertiesMap method. That way we can selectively enrich the properties of one transaction type or the other.

By separating the properties by transaction type, it would be possible to 'autoconfigure' the backwards compatibility with spring in standalone mode and also keep the backwards compatibility with the JTA configuration.

What do you think?


Affects: 4.3.6

Issue Links:

Referenced from: pull request #1591

Backported to: 4.3.13

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions