Skip to content

Commit

Permalink
deprecate PersistenceUnitTransactionType and add EntityManagerFactory…
Browse files Browse the repository at this point in the history
….getTransactionType

rename PersistenceTransactionType to PersistenceUnitTransactionType

see jakartaee#477
  • Loading branch information
gavinking committed Aug 24, 2023
1 parent 42155f8 commit 2d4ff75
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Class<?>> managedClasses = new ArrayList<>();
private final List<String> mappingFileNames = new ArrayList<>();
Expand Down Expand Up @@ -334,25 +334,25 @@ public List<String> 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}.
* <ul>
* <li>If {@link PersistenceTransactionType#JTA}, a JTA data
* <li>If {@link PersistenceUnitTransactionType#JTA}, a JTA data
* source must be provided via {@link #jtaDataSource()},
* or by the container.
* <li>If {@link PersistenceTransactionType#RESOURCE_LOCAL},
* <li>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()}.
* </ul>
* @return the transaction type
*/
public PersistenceTransactionType transactionType() {
public PersistenceUnitTransactionType transactionType() {
return transactionType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @since 3.2
*/
public enum PersistenceTransactionType {
public enum PersistenceUnitTransactionType {
/**
* Transaction management via JTA.
*/
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/persistence/ValidationMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public enum ValidationMode {
* The persistence provider must not perform lifecycle event validation.
*/
NONE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 2d4ff75

Please sign in to comment.