Richard Zowalla created OPENJPA-3005:
----------------------------------------
Summary: Use jakarta.persistence.PersistenceUnitTransactionType
internally instead of the deprecated SPI enum
Key: OPENJPA-3005
URL: https://issues.apache.org/jira/browse/OPENJPA-3005
Project: OpenJPA
Issue Type: Sub-task
Components: jpa
Reporter: Richard Zowalla
Fix For: 4.2.0
Jakarta Persistence 3.2 deprecates
{{jakarta.persistence.spi.PersistenceUnitTransactionType}} \(forRemoval =
true\) in favour of {{jakarta.persistence.PersistenceUnitTransactionType}}.
{{EntityManagerFactoryImpl}} already uses the new enum, while
{{PersistenceUnitInfoImpl}} and {{PersistenceProductDerivation}} still use the
SPI one.
A plain import swap is not possible:
{{PersistenceUnitInfo#getTransactionType\(\)}} still returns the SPI enum in
3.2 \(the spec announces the return type change for the next major version\),
and {{PersistenceUnitInfoImpl}} implements that interface.
In addition, passing {{jakarta.persistence.transactionType}} as a
{{jakarta.persistence.PersistenceUnitTransactionType}} value \(rather than a
String or the SPI enum\) is silently turned into a null transaction type.
Proposal:
\* keep the transaction type in {{PersistenceUnitInfoImpl}} as
{{jakarta.persistence.PersistenceUnitTransactionType}}, and convert to the SPI
enum only in {{getTransactionType\(\)}}
\* keep a deprecated {{setTransactionType}} overload taking the SPI enum
\* accept both enums \(and Strings\) for the
{{jakarta.persistence.transactionType}} property
\* drop the manual JTA/RESOURCE\_LOCAL mapping in
{{convert\(PersistenceConfiguration\)}}
Once the spec changes the return type, only the getter needs to change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)