Skip to content

[OPENJPA-3005] Use jakarta.persistence.PersistenceUnitTransactionType internally - #190

Merged
cristof merged 1 commit into
masterfrom
OPENJPA-3005
Sep 15, 2026
Merged

cristof merged 1 commit into
masterfrom
OPENJPA-3005

Conversation

@rzo1

@rzo1 rzo1 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/OPENJPA-3005

Follow-up to the review of #186: jakarta.persistence.spi.PersistenceUnitTransactionType is deprecated for removal in Jakarta Persistence 3.2, but the imports cannot simply be swapped because PersistenceUnitInfo#getTransactionType() still returns the SPI enum until the next major version.

  • PersistenceUnitInfoImpl keeps the transaction type as jakarta.persistence.PersistenceUnitTransactionType and only converts to the SPI enum in getTransactionType(). Once the spec changes the return type, only that getter needs to change.
  • A deprecated setTransactionType overload taking the SPI enum is kept for compatibility.
  • The jakarta.persistence.transactionType property accepts Strings and both enums. Passing a jakarta.persistence.PersistenceUnitTransactionType value used to be silently turned into a null transaction type.
  • convert(PersistenceConfiguration) no longer needs the manual JTA/RESOURCE_LOCAL mapping.
  • PersistenceProductDerivation uses the new enum when parsing transaction-type from persistence.xml.

TestPersistenceUnitInfoTransactionType covers the default, PersistenceConfiguration, String / enum / SPI enum properties and the deprecated setter. testFromUserPropertiesAsEnum fails without this change.

Note: this touches the import block of PersistenceProductDerivation next to a line removed by #186, so whichever is merged second needs a trivial rebase.

… internally

PersistenceUnitInfoImpl keeps the transaction type as the non-deprecated
jakarta.persistence.PersistenceUnitTransactionType and only converts to the
SPI enum in getTransactionType(), which PersistenceUnitInfo still requires in
Jakarta Persistence 3.2. A deprecated setter taking the SPI enum is kept.

The jakarta.persistence.transactionType property now accepts both enums, a
jakarta.persistence.PersistenceUnitTransactionType value was silently turned
into a null transaction type before.
@rzo1
rzo1 requested a review from solomax September 15, 2026 09:02
@rzo1 rzo1 self-assigned this Sep 15, 2026

@solomax solomax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for initiating this
I was sure it should be easier :(

@cristof
cristof merged commit 830a0b4 into master Sep 15, 2026
4 checks passed
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.

3 participants