[OPENJPA-3005] Use jakarta.persistence.PersistenceUnitTransactionType internally - #190
Merged
Merged
Conversation
… 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.
solomax
approved these changes
Sep 15, 2026
solomax
left a comment
Contributor
There was a problem hiding this comment.
sorry for initiating this
I was sure it should be easier :(
cristof
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/OPENJPA-3005
Follow-up to the review of #186:
jakarta.persistence.spi.PersistenceUnitTransactionTypeis deprecated for removal in Jakarta Persistence 3.2, but the imports cannot simply be swapped becausePersistenceUnitInfo#getTransactionType()still returns the SPI enum until the next major version.PersistenceUnitInfoImplkeeps the transaction type asjakarta.persistence.PersistenceUnitTransactionTypeand only converts to the SPI enum ingetTransactionType(). Once the spec changes the return type, only that getter needs to change.setTransactionTypeoverload taking the SPI enum is kept for compatibility.jakarta.persistence.transactionTypeproperty accepts Strings and both enums. Passing ajakarta.persistence.PersistenceUnitTransactionTypevalue used to be silently turned into anulltransaction type.convert(PersistenceConfiguration)no longer needs the manual JTA/RESOURCE_LOCAL mapping.PersistenceProductDerivationuses the new enum when parsingtransaction-typefrompersistence.xml.TestPersistenceUnitInfoTransactionTypecovers the default,PersistenceConfiguration, String / enum / SPI enum properties and the deprecated setter.testFromUserPropertiesAsEnumfails without this change.Note: this touches the import block of
PersistenceProductDerivationnext to a line removed by #186, so whichever is merged second needs a trivial rebase.