diff --git a/api/src/main/java/jakarta/persistence/EntityManagerFactory.java b/api/src/main/java/jakarta/persistence/EntityManagerFactory.java index ec2db1cc..16845f24 100644 --- a/api/src/main/java/jakarta/persistence/EntityManagerFactory.java +++ b/api/src/main/java/jakarta/persistence/EntityManagerFactory.java @@ -171,6 +171,14 @@ public interface EntityManagerFactory extends AutoCloseable { */ public PersistenceUnitUtil getPersistenceUnitUtil(); + /** + *The type of transaction management used by this persistence + * unit, either resource-local transaction management, or JTA. + * + * @since 3.2 + */ + public PersistenceUnitTransactionType getTransactionType(); + /** * Return interface providing access to schema management * operations for the persistence unit. diff --git a/api/src/main/java/jakarta/persistence/PersistenceConfiguration.java b/api/src/main/java/jakarta/persistence/PersistenceConfiguration.java index 1385d05b..369fe23f 100644 --- a/api/src/main/java/jakarta/persistence/PersistenceConfiguration.java +++ b/api/src/main/java/jakarta/persistence/PersistenceConfiguration.java @@ -196,7 +196,7 @@ public class PersistenceConfiguration { private SharedCacheMode sharedCacheMode = SharedCacheMode.UNSPECIFIED; private ValidationMode validationMode = ValidationMode.AUTO; - private PersistenceTransactionType transactionType = PersistenceTransactionType.RESOURCE_LOCAL; + private PersistenceUnitTransactionType transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; private final List> managedClasses = new ArrayList<>(); private final List mappingFileNames = new ArrayList<>(); @@ -334,25 +334,25 @@ public List mappingFiles() { * @param transactionType the transaction type * @return this configuration */ - public PersistenceConfiguration transactionType(PersistenceTransactionType transactionType) { + public PersistenceConfiguration transactionType(PersistenceUnitTransactionType transactionType) { this.transactionType = transactionType; return this; } /** - * The {@linkplain PersistenceTransactionType transaction type}. + * The {@linkplain PersistenceUnitTransactionType transaction type}. *
    - *
  • If {@link PersistenceTransactionType#JTA}, a JTA data + *
  • If {@link PersistenceUnitTransactionType#JTA}, a JTA data * source must be provided via {@link #jtaDataSource()}, * or by the container. - *
  • If {@link PersistenceTransactionType#RESOURCE_LOCAL}, + *
  • If {@link PersistenceUnitTransactionType#RESOURCE_LOCAL}, * database connection properties may be specified via * {@link #properties()}, or a non-JTA datasource may be * provided via {@link #nonJtaDataSource()}. *
* @return the transaction type */ - public PersistenceTransactionType transactionType() { + public PersistenceUnitTransactionType transactionType() { return transactionType; } diff --git a/api/src/main/java/jakarta/persistence/PersistenceTransactionType.java b/api/src/main/java/jakarta/persistence/PersistenceUnitTransactionType.java similarity index 95% rename from api/src/main/java/jakarta/persistence/PersistenceTransactionType.java rename to api/src/main/java/jakarta/persistence/PersistenceUnitTransactionType.java index a82e5bed..e24055f0 100644 --- a/api/src/main/java/jakarta/persistence/PersistenceTransactionType.java +++ b/api/src/main/java/jakarta/persistence/PersistenceUnitTransactionType.java @@ -23,7 +23,7 @@ * * @since 3.2 */ -public enum PersistenceTransactionType { +public enum PersistenceUnitTransactionType { /** * Transaction management via JTA. */ diff --git a/api/src/main/java/jakarta/persistence/ValidationMode.java b/api/src/main/java/jakarta/persistence/ValidationMode.java index 2b406b4d..9ce9fa6d 100644 --- a/api/src/main/java/jakarta/persistence/ValidationMode.java +++ b/api/src/main/java/jakarta/persistence/ValidationMode.java @@ -44,4 +44,4 @@ public enum ValidationMode { * The persistence provider must not perform lifecycle event validation. */ NONE - } +} diff --git a/api/src/main/java/jakarta/persistence/spi/PersistenceUnitTransactionType.java b/api/src/main/java/jakarta/persistence/spi/PersistenceUnitTransactionType.java index ab293246..3375c336 100644 --- a/api/src/main/java/jakarta/persistence/spi/PersistenceUnitTransactionType.java +++ b/api/src/main/java/jakarta/persistence/spi/PersistenceUnitTransactionType.java @@ -22,7 +22,11 @@ * resource-local entity managers. * * @since 1.0 + * + * @deprecated replaced by + * {@link jakarta.persistence.PersistenceUnitTransactionType} */ +@Deprecated(since = "3.2", forRemoval = true) public enum PersistenceUnitTransactionType { /** JTA entity managers will be created. */