Jakarta EE 9 migration
Upgrades many dependency declarations; removes old EJB 2.x support and outdated Servlet-based integrations (Commons FileUpload, FreeMarker JSP support, Tiles). Closes gh-22093 Closes gh-25354 Closes gh-26185 Closes gh-27423 See gh-27424
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
|
||||
package org.springframework.orm.hibernate5;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.Synchronization;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.TransactionSynchronizationRegistry;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import jakarta.transaction.Status;
|
||||
import jakarta.transaction.Synchronization;
|
||||
import jakarta.transaction.SystemException;
|
||||
import jakarta.transaction.Transaction;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import jakarta.transaction.TransactionSynchronizationRegistry;
|
||||
import jakarta.transaction.UserTransaction;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
package org.springframework.orm.hibernate5;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.Criteria;
|
||||
|
||||
@@ -20,9 +20,9 @@ import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
@@ -281,7 +281,7 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
|
||||
|
||||
/**
|
||||
* Set the Spring {@link org.springframework.transaction.jta.JtaTransactionManager}
|
||||
* or the JTA {@link javax.transaction.TransactionManager} to be used with Hibernate,
|
||||
* or the JTA {@link jakarta.transaction.TransactionManager} to be used with Hibernate,
|
||||
* if any. Implicitly sets up {@code JtaPlatform}.
|
||||
* @see LocalSessionFactoryBuilder#setJtaTransactionManager
|
||||
*/
|
||||
@@ -343,8 +343,8 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
|
||||
/**
|
||||
* Specify custom type filters for Spring-based scanning for entity classes.
|
||||
* <p>Default is to search all specified packages for classes annotated with
|
||||
* {@code @javax.persistence.Entity}, {@code @javax.persistence.Embeddable}
|
||||
* or {@code @javax.persistence.MappedSuperclass}.
|
||||
* {@code @jakarta.persistence.Entity}, {@code @jakarta.persistence.Embeddable}
|
||||
* or {@code @jakarta.persistence.MappedSuperclass}.
|
||||
* @see #setPackagesToScan
|
||||
*/
|
||||
public void setEntityTypeFilters(TypeFilter... entityTypeFilters) {
|
||||
|
||||
@@ -28,14 +28,14 @@ import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.sql.DataSource;
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.SessionFactory;
|
||||
@@ -269,8 +269,8 @@ public class LocalSessionFactoryBuilder extends Configuration {
|
||||
/**
|
||||
* Specify custom type filters for Spring-based scanning for entity classes.
|
||||
* <p>Default is to search all specified packages for classes annotated with
|
||||
* {@code @javax.persistence.Entity}, {@code @javax.persistence.Embeddable}
|
||||
* or {@code @javax.persistence.MappedSuperclass}.
|
||||
* {@code @jakarta.persistence.Entity}, {@code @jakarta.persistence.Embeddable}
|
||||
* or {@code @jakarta.persistence.MappedSuperclass}.
|
||||
* @see #scanPackages
|
||||
*/
|
||||
public LocalSessionFactoryBuilder setEntityTypeFilters(TypeFilter... entityTypeFilters) {
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.orm.hibernate5;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package org.springframework.orm.hibernate5;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import jakarta.transaction.Status;
|
||||
import jakarta.transaction.SystemException;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
@@ -18,11 +18,10 @@ package org.springframework.orm.hibernate5.support;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
|
||||
@@ -34,15 +34,15 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.SynchronizationType;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.SynchronizationType;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Abstract {@link org.springframework.beans.factory.FactoryBean} that creates
|
||||
* a local JPA {@link javax.persistence.EntityManagerFactory} instance within
|
||||
* a local JPA {@link jakarta.persistence.EntityManagerFactory} instance within
|
||||
* a Spring application context.
|
||||
*
|
||||
* <p>Encapsulates the common functionality between the different JPA bootstrap
|
||||
@@ -149,8 +149,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* taken from the JpaVendorAdapter (if any) or retrieved through scanning
|
||||
* (as far as possible).
|
||||
* @see JpaVendorAdapter#getPersistenceProvider()
|
||||
* @see javax.persistence.spi.PersistenceProvider
|
||||
* @see javax.persistence.Persistence
|
||||
* @see jakarta.persistence.spi.PersistenceProvider
|
||||
* @see jakarta.persistence.Persistence
|
||||
*/
|
||||
public void setPersistenceProviderClass(Class<? extends PersistenceProvider> persistenceProviderClass) {
|
||||
this.persistenceProvider = BeanUtils.instantiateClass(persistenceProviderClass);
|
||||
@@ -162,8 +162,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* will be taken from the JpaVendorAdapter (if any) or determined
|
||||
* by the persistence unit deployment descriptor (as far as possible).
|
||||
* @see JpaVendorAdapter#getPersistenceProvider()
|
||||
* @see javax.persistence.spi.PersistenceProvider
|
||||
* @see javax.persistence.Persistence
|
||||
* @see jakarta.persistence.spi.PersistenceProvider
|
||||
* @see jakarta.persistence.Persistence
|
||||
*/
|
||||
public void setPersistenceProvider(@Nullable PersistenceProvider persistenceProvider) {
|
||||
this.persistenceProvider = persistenceProvider;
|
||||
@@ -180,7 +180,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* <p>Default is none, indicating the default EntityManagerFactory
|
||||
* configuration. The persistence provider will throw an exception if
|
||||
* ambiguous EntityManager configurations are found.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String)
|
||||
* @see jakarta.persistence.Persistence#createEntityManagerFactory(String)
|
||||
*/
|
||||
public void setPersistenceUnitName(@Nullable String persistenceUnitName) {
|
||||
this.persistenceUnitName = persistenceUnitName;
|
||||
@@ -197,8 +197,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor) or a
|
||||
* "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
* @see jakarta.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
*/
|
||||
public void setJpaProperties(Properties jpaProperties) {
|
||||
CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
|
||||
@@ -208,8 +208,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
* @see jakarta.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
*/
|
||||
public void setJpaPropertyMap(@Nullable Map<String, ?> jpaProperties) {
|
||||
if (jpaProperties != null) {
|
||||
@@ -231,7 +231,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify the (potentially vendor-specific) EntityManagerFactory interface
|
||||
* that this EntityManagerFactory proxy is supposed to implement.
|
||||
* <p>The default will be taken from the specific JpaVendorAdapter, if any,
|
||||
* or set to the standard {@code javax.persistence.EntityManagerFactory}
|
||||
* or set to the standard {@code jakarta.persistence.EntityManagerFactory}
|
||||
* interface else.
|
||||
* @see JpaVendorAdapter#getEntityManagerFactoryInterface()
|
||||
*/
|
||||
@@ -243,7 +243,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify the (potentially vendor-specific) EntityManager interface
|
||||
* that this factory's EntityManagers are supposed to implement.
|
||||
* <p>The default will be taken from the specific JpaVendorAdapter, if any,
|
||||
* or set to the standard {@code javax.persistence.EntityManager}
|
||||
* or set to the standard {@code jakarta.persistence.EntityManager}
|
||||
* interface else.
|
||||
* @see JpaVendorAdapter#getEntityManagerInterface()
|
||||
* @see EntityManagerFactoryInfo#getEntityManagerInterface()
|
||||
@@ -468,7 +468,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
if (entityManagerFactoryInterface != null) {
|
||||
throw new IllegalStateException("EntityManagerFactory interface [" + entityManagerFactoryInterface +
|
||||
"] seems to conflict with Spring's EntityManagerFactoryInfo mixin - consider resetting the "+
|
||||
"'entityManagerFactoryInterface' property to plain [javax.persistence.EntityManagerFactory]", ex);
|
||||
"'entityManagerFactoryInterface' property to plain [jakarta.persistence.EntityManagerFactory]", ex);
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Conflicting EntityManagerFactory interfaces - " +
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.orm.jpa;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.datasource.ConnectionHandle;
|
||||
@@ -53,7 +53,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* is no state to be kept for a standard JPA transaction. Hence, subclasses do not
|
||||
* have to care about the return value ({@code null}) of this implementation
|
||||
* and are free to return their own transaction data Object.
|
||||
* @see javax.persistence.EntityTransaction#begin
|
||||
* @see jakarta.persistence.EntityTransaction#begin
|
||||
* @see org.springframework.transaction.InvalidIsolationLevelException
|
||||
* @see #cleanupTransaction
|
||||
*/
|
||||
|
||||
@@ -20,9 +20,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -59,8 +58,8 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
/**
|
||||
* Set the JPA EntityManagerFactory that should be used to create
|
||||
* EntityManagers.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public void setEntityManagerFactory(@Nullable EntityManagerFactory emf) {
|
||||
this.entityManagerFactory = emf;
|
||||
@@ -112,7 +111,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor)
|
||||
* or a "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public void setJpaProperties(Properties jpaProperties) {
|
||||
CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
|
||||
@@ -122,7 +121,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public void setJpaPropertyMap(@Nullable Map<String, Object> jpaProperties) {
|
||||
if (jpaProperties != null) {
|
||||
@@ -162,8 +161,8 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
* <p>Can be overridden in subclasses to create specific EntityManager variants.
|
||||
* @return a new EntityManager
|
||||
* @throws IllegalStateException if this accessor is not configured with an EntityManagerFactory
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
protected EntityManager createEntityManager() throws IllegalStateException {
|
||||
EntityManagerFactory emf = obtainEntityManagerFactory();
|
||||
@@ -175,8 +174,8 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
* Obtain the transactional EntityManager for this accessor's EntityManagerFactory, if any.
|
||||
* @return the transactional EntityManager, or {@code null} if none
|
||||
* @throws IllegalStateException if this accessor is not configured with an EntityManagerFactory
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory, java.util.Map)
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(jakarta.persistence.EntityManagerFactory)
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(jakarta.persistence.EntityManagerFactory, java.util.Map)
|
||||
*/
|
||||
@Nullable
|
||||
protected EntityManager getTransactionalEntityManager() throws IllegalStateException{
|
||||
|
||||
@@ -18,12 +18,13 @@ package org.springframework.orm.jpa;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ public interface EntityManagerFactoryInfo {
|
||||
* {@code getPersistenceUnitName()} must be equal to the value returned by
|
||||
* {@code PersistenceUnitInfo.getPersistenceUnitName()}.
|
||||
* @see #getPersistenceUnitInfo()
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
|
||||
*/
|
||||
@Nullable
|
||||
String getPersistenceUnitName();
|
||||
@@ -83,7 +84,7 @@ public interface EntityManagerFactoryInfo {
|
||||
* that this factory's EntityManagers will implement.
|
||||
* <p>A {@code null} return value suggests that autodetection is supposed
|
||||
* to happen: either based on a target {@code EntityManager} instance
|
||||
* or simply defaulting to {@code javax.persistence.EntityManager}.
|
||||
* or simply defaulting to {@code jakarta.persistence.EntityManager}.
|
||||
*/
|
||||
@Nullable
|
||||
Class<? extends EntityManager> getEntityManagerInterface();
|
||||
|
||||
@@ -18,21 +18,20 @@ package org.springframework.orm.jpa;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityExistsException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.persistence.LockTimeoutException;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.PessimisticLockException;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.QueryTimeoutException;
|
||||
import javax.persistence.SynchronizationType;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityExistsException;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.LockTimeoutException;
|
||||
import jakarta.persistence.NoResultException;
|
||||
import jakarta.persistence.NonUniqueResultException;
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.PessimisticLockException;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.QueryTimeoutException;
|
||||
import jakarta.persistence.SynchronizationType;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -168,8 +167,8 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* @param properties the properties to be passed into the {@code createEntityManager}
|
||||
* call (may be {@code null})
|
||||
* @return the EntityManager, or {@code null} if none found
|
||||
* @throws javax.persistence.PersistenceException if the EntityManager couldn't be created
|
||||
* @see #getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
|
||||
* @throws jakarta.persistence.PersistenceException if the EntityManager couldn't be created
|
||||
* @see #getTransactionalEntityManager(jakarta.persistence.EntityManagerFactory)
|
||||
* @see JpaTransactionManager
|
||||
*/
|
||||
@Nullable
|
||||
@@ -189,8 +188,8 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* @param synchronizedWithTransaction whether to automatically join ongoing
|
||||
* transactions (according to the JPA 2.1 SynchronizationType rules)
|
||||
* @return the EntityManager, or {@code null} if none found
|
||||
* @throws javax.persistence.PersistenceException if the EntityManager couldn't be created
|
||||
* @see #getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
|
||||
* @throws jakarta.persistence.PersistenceException if the EntityManager couldn't be created
|
||||
* @see #getTransactionalEntityManager(jakarta.persistence.EntityManagerFactory)
|
||||
* @see JpaTransactionManager
|
||||
*/
|
||||
@Nullable
|
||||
@@ -334,7 +333,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
|
||||
/**
|
||||
* Apply the current transaction timeout, if any, to the given JPA Query object.
|
||||
* <p>This method sets the JPA 2.0 query hint "javax.persistence.query.timeout" accordingly.
|
||||
* <p>This method sets the JPA 2.0 query hint "jakarta.persistence.query.timeout" accordingly.
|
||||
* @param query the JPA Query object
|
||||
* @param emf the JPA EntityManagerFactory that the Query was created for
|
||||
*/
|
||||
@@ -343,7 +342,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
if (emHolder != null && emHolder.hasTimeout()) {
|
||||
int timeoutValue = (int) emHolder.getTimeToLiveInMillis();
|
||||
try {
|
||||
query.setHint("javax.persistence.query.timeout", timeoutValue);
|
||||
query.setHint("jakarta.persistence.query.timeout", timeoutValue);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// oh well, at least we tried...
|
||||
@@ -418,7 +417,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* Close the given JPA EntityManager,
|
||||
* catching and logging any cleanup exceptions thrown.
|
||||
* @param em the JPA EntityManager to close (may be {@code null})
|
||||
* @see javax.persistence.EntityManager#close()
|
||||
* @see jakarta.persistence.EntityManager#close()
|
||||
*/
|
||||
public static void closeEntityManager(@Nullable EntityManager em) {
|
||||
if (em != null) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.SavepointManager;
|
||||
@@ -26,7 +26,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Resource holder wrapping a JPA {@link EntityManager}.
|
||||
* {@link JpaTransactionManager} binds instances of this class to the thread,
|
||||
* for a given {@link javax.persistence.EntityManagerFactory}.
|
||||
* for a given {@link jakarta.persistence.EntityManagerFactory}.
|
||||
*
|
||||
* <p>Also serves as a base class for {@link org.springframework.orm.hibernate5.SessionHolder},
|
||||
* as of 5.1.
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
/**
|
||||
* Subinterface of {@link javax.persistence.EntityManager} to be implemented by
|
||||
* Subinterface of {@link jakarta.persistence.EntityManager} to be implemented by
|
||||
* EntityManager proxies. Allows access to the underlying target EntityManager.
|
||||
*
|
||||
* <p>This interface is mainly intended for framework usage. Application code
|
||||
* should prefer the use of the {@link javax.persistence.EntityManager#getDelegate()}
|
||||
* should prefer the use of the {@link jakarta.persistence.EntityManager#getDelegate()}
|
||||
* method to access native functionality of the underlying resource.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -25,13 +25,12 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -47,14 +46,14 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
|
||||
/**
|
||||
* Delegate for creating a variety of {@link javax.persistence.EntityManager}
|
||||
* Delegate for creating a variety of {@link jakarta.persistence.EntityManager}
|
||||
* proxies that follow the JPA spec's semantics for "extended" EntityManagers.
|
||||
*
|
||||
* <p>Supports several different variants of "extended" EntityManagers:
|
||||
* in particular, an "application-managed extended EntityManager", as defined
|
||||
* by {@link javax.persistence.EntityManagerFactory#createEntityManager()},
|
||||
* by {@link jakarta.persistence.EntityManagerFactory#createEntityManager()},
|
||||
* as well as a "container-managed extended EntityManager", as defined by
|
||||
* {@link javax.persistence.PersistenceContextType#EXTENDED}.
|
||||
* {@link jakarta.persistence.PersistenceContextType#EXTENDED}.
|
||||
*
|
||||
* <p>The original difference between "application-managed" and "container-managed"
|
||||
* was the need for explicit joining of an externally managed transaction through
|
||||
@@ -69,9 +68,9 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
* @author Rod Johnson
|
||||
* @author Mark Paluch
|
||||
* @since 2.0
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see javax.persistence.PersistenceContextType#EXTENDED
|
||||
* @see javax.persistence.EntityManager#joinTransaction()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.PersistenceContextType#EXTENDED
|
||||
* @see jakarta.persistence.EntityManager#joinTransaction()
|
||||
* @see SharedEntityManagerCreator
|
||||
*/
|
||||
public abstract class ExtendedEntityManagerCreator {
|
||||
@@ -131,7 +130,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* JpaDialect and PersistenceUnitInfo will be detected accordingly.
|
||||
* @return a container-managed EntityManager that will automatically participate
|
||||
* in any managed transaction
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
*/
|
||||
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf) {
|
||||
return createContainerManagedEntityManager(emf, null, true);
|
||||
@@ -146,7 +145,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* call (may be {@code null})
|
||||
* @return a container-managed EntityManager that will automatically participate
|
||||
* in any managed transaction
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, @Nullable Map<?, ?> properties) {
|
||||
return createContainerManagedEntityManager(emf, properties, true);
|
||||
@@ -164,7 +163,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* @return a container-managed EntityManager that expects container-driven lifecycle
|
||||
* management but may opt out of automatic transaction synchronization
|
||||
* @since 4.0
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public static EntityManager createContainerManagedEntityManager(
|
||||
EntityManagerFactory emf, @Nullable Map<?, ?> properties, boolean synchronizedWithTransaction) {
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.orm.jpa;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.jdbc.datasource.ConnectionHandle;
|
||||
@@ -73,11 +73,11 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* @return an arbitrary object that holds transaction data, if any
|
||||
* (to be passed into {@link #cleanupTransaction}). May implement the
|
||||
* {@link org.springframework.transaction.SavepointManager} interface.
|
||||
* @throws javax.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws jakarta.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws java.sql.SQLException if thrown by JDBC methods
|
||||
* @throws org.springframework.transaction.TransactionException in case of invalid arguments
|
||||
* @see #cleanupTransaction
|
||||
* @see javax.persistence.EntityTransaction#begin
|
||||
* @see jakarta.persistence.EntityTransaction#begin
|
||||
* @see org.springframework.jdbc.datasource.DataSourceUtils#prepareConnectionForTransaction
|
||||
*/
|
||||
@Nullable
|
||||
@@ -100,7 +100,7 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* @param name the name of the transaction (if any)
|
||||
* @return an arbitrary object that holds transaction data, if any
|
||||
* (to be passed into cleanupTransaction)
|
||||
* @throws javax.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws jakarta.persistence.PersistenceException if thrown by JPA methods
|
||||
* @see #cleanupTransaction
|
||||
*/
|
||||
@Nullable
|
||||
@@ -143,7 +143,7 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* @param readOnly whether the Connection is only needed for read-only purposes
|
||||
* @return a handle for the Connection, to be passed into {@code releaseJdbcConnection},
|
||||
* or {@code null} if no JDBC Connection can be retrieved
|
||||
* @throws javax.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws jakarta.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws java.sql.SQLException if thrown by JDBC methods
|
||||
* @see #releaseJdbcConnection
|
||||
* @see org.springframework.jdbc.datasource.ConnectionHandle#getConnection
|
||||
@@ -163,7 +163,7 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* transaction completes or when the EntityManager is closed.
|
||||
* @param conHandle the JDBC Connection handle to release
|
||||
* @param entityManager the current JPA EntityManager
|
||||
* @throws javax.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws jakarta.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws java.sql.SQLException if thrown by JDBC methods
|
||||
* @see #getJdbcConnection
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
|
||||
import org.springframework.orm.ObjectRetrievalFailureException;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
|
||||
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
||||
|
||||
|
||||
@@ -21,13 +21,14 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.RollbackException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.RollbackException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
@@ -58,7 +59,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.transaction.PlatformTransactionManager} implementation
|
||||
* for a single JPA {@link javax.persistence.EntityManagerFactory}. Binds a JPA
|
||||
* for a single JPA {@link jakarta.persistence.EntityManagerFactory}. Binds a JPA
|
||||
* EntityManager from the specified factory to the thread, potentially allowing for
|
||||
* one thread-bound EntityManager per factory. {@link SharedEntityManagerCreator} and
|
||||
* {@code @PersistenceContext} are aware of thread-bound entity managers and participate
|
||||
@@ -209,7 +210,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor)
|
||||
* or a "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public void setJpaProperties(@Nullable Properties jpaProperties) {
|
||||
CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
|
||||
@@ -219,7 +220,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
public void setJpaPropertyMap(@Nullable Map<String, ?> jpaProperties) {
|
||||
if (jpaProperties != null) {
|
||||
@@ -475,7 +476,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* {@link EntityManagerFactoryInfo#createNativeEntityManager}
|
||||
* if possible which in turns applies
|
||||
* {@link JpaVendorAdapter#postProcessEntityManager(EntityManager)}.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
*/
|
||||
protected EntityManager createEntityManagerForTransaction() {
|
||||
EntityManagerFactory emf = obtainEntityManagerFactory();
|
||||
|
||||
@@ -19,10 +19,10 @@ package org.springframework.orm.jpa;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -64,10 +64,10 @@ public interface JpaVendorAdapter {
|
||||
* non-unit-dependent properties. Effectively, this PersistenceUnitInfo-based
|
||||
* variant only needs to be implemented if there is an actual need to react
|
||||
* to unit-specific characteristics such as the transaction type.
|
||||
* <p><b>NOTE:</b> This variant will only be invoked in case of Java EE style
|
||||
* <p><b>NOTE:</b> This variant will only be invoked in case of Jakarta EE style
|
||||
* container bootstrapping where a {@link PersistenceUnitInfo} is present
|
||||
* (i.e. {@link LocalContainerEntityManagerFactoryBean}. In case of simple
|
||||
* Java SE style bootstrapping via {@link javax.persistence.Persistence}
|
||||
* Java SE style bootstrapping via {@link jakarta.persistence.Persistence}
|
||||
* (i.e. {@link LocalEntityManagerFactoryBean}), the parameter-less
|
||||
* {@link #getJpaPropertyMap()} variant will be called directly.
|
||||
* @param pui the PersistenceUnitInfo for the current persistence unit
|
||||
@@ -75,7 +75,7 @@ public interface JpaVendorAdapter {
|
||||
* facilities, or an empty Map if there are no properties to expose
|
||||
* @since 4.3.13
|
||||
* @see PersistenceUnitInfo#getTransactionType()
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
*/
|
||||
default Map<String, ?> getJpaPropertyMap(PersistenceUnitInfo pui) {
|
||||
return getJpaPropertyMap();
|
||||
@@ -89,7 +89,7 @@ public interface JpaVendorAdapter {
|
||||
* JPA property values specified here.
|
||||
* @return a Map of JPA properties, as accepted by the standard JPA bootstrap
|
||||
* facilities, or an empty Map if there are no properties to expose
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see jakarta.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
*/
|
||||
default Map<String, ?> getJpaPropertyMap() {
|
||||
return Collections.emptyMap();
|
||||
@@ -109,7 +109,7 @@ public interface JpaVendorAdapter {
|
||||
* that the EntityManagerFactory proxy is supposed to implement.
|
||||
* <p>If the provider does not offer any EntityManagerFactory extensions,
|
||||
* the adapter should simply return the standard
|
||||
* {@link javax.persistence.EntityManagerFactory} class here.
|
||||
* {@link jakarta.persistence.EntityManagerFactory} class here.
|
||||
* @since 2.5.2
|
||||
*/
|
||||
default Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() {
|
||||
@@ -121,7 +121,7 @@ public interface JpaVendorAdapter {
|
||||
* that this provider's EntityManagers will implement.
|
||||
* <p>If the provider does not offer any EntityManager extensions,
|
||||
* the adapter should simply return the standard
|
||||
* {@link javax.persistence.EntityManager} class here.
|
||||
* {@link jakarta.persistence.EntityManager} class here.
|
||||
*/
|
||||
default Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return EntityManager.class;
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.SharedCacheMode;
|
||||
import jakarta.persistence.ValidationMode;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
import org.springframework.context.weaving.LoadTimeWeaverAware;
|
||||
@@ -40,7 +41,7 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.FactoryBean} that creates a JPA
|
||||
* {@link javax.persistence.EntityManagerFactory} according to JPA's standard
|
||||
* {@link jakarta.persistence.EntityManagerFactory} according to JPA's standard
|
||||
* <i>container</i> bootstrap contract. This is the most powerful way to set
|
||||
* up a shared JPA EntityManagerFactory in a Spring application context;
|
||||
* the EntityManagerFactory can then be passed to JPA-based DAOs via
|
||||
@@ -58,10 +59,10 @@ import org.springframework.util.ClassUtils;
|
||||
* instead of being tied to a special VM agent specified on JVM startup.
|
||||
*
|
||||
* <p>Internally, this FactoryBean parses the {@code persistence.xml} file
|
||||
* itself and creates a corresponding {@link javax.persistence.spi.PersistenceUnitInfo}
|
||||
* itself and creates a corresponding {@link jakarta.persistence.spi.PersistenceUnitInfo}
|
||||
* object (with further configuration merged in, such as JDBC DataSources and the
|
||||
* Spring LoadTimeWeaver), to be passed to the chosen JPA
|
||||
* {@link javax.persistence.spi.PersistenceProvider}. This corresponds to a
|
||||
* {@link jakarta.persistence.spi.PersistenceProvider}. This corresponds to a
|
||||
* local JPA container with full support for the standard JPA container contract.
|
||||
*
|
||||
* <p>The exposed EntityManagerFactory object will implement all the interfaces of
|
||||
@@ -84,7 +85,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see EntityManagerFactoryInfo
|
||||
* @see LocalEntityManagerFactoryBean
|
||||
* @see org.springframework.orm.jpa.support.SharedEntityManagerBean
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean
|
||||
@@ -220,7 +221,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* overriding a value in {@code persistence.xml} if set.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @since 4.0
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
|
||||
@@ -232,7 +233,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* overriding a value in {@code persistence.xml} if set.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @since 4.0
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getValidationMode()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getValidationMode()
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
public void setValidationMode(ValidationMode validationMode) {
|
||||
@@ -250,7 +251,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* Note that this variant typically works for JTA transaction management as well;
|
||||
* if it does not, consider using the explicit {@link #setJtaDataSource} instead.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
@@ -267,7 +268,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
|
||||
* overriding data source configuration in {@code persistence.xml} (if any).
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
public void setJtaDataSource(DataSource jtaDataSource) {
|
||||
@@ -394,7 +395,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* <p>The default implementation is empty.
|
||||
* @param emf the newly created EntityManagerFactory we are working with
|
||||
* @param pui the PersistenceUnitInfo used to configure the EntityManagerFactory
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory
|
||||
*/
|
||||
protected void postProcessEntityManagerFactory(EntityManagerFactory emf, PersistenceUnitInfo pui) {
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Persistence;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.Persistence;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.FactoryBean} that creates a JPA
|
||||
* {@link javax.persistence.EntityManagerFactory} according to JPA's standard
|
||||
* {@link jakarta.persistence.EntityManagerFactory} according to JPA's standard
|
||||
* <i>standalone</i> bootstrap contract. This is the simplest way to set up a
|
||||
* shared JPA EntityManagerFactory in a Spring application context; the
|
||||
* EntityManagerFactory can then be passed to JPA-based DAOs via
|
||||
@@ -41,7 +41,7 @@ import javax.persistence.spi.PersistenceProvider;
|
||||
* <p>This EntityManagerFactory bootstrap is appropriate for standalone applications
|
||||
* which solely use JPA for data access. If you want to set up your persistence
|
||||
* provider for an external DataSource and/or for global transactions which span
|
||||
* multiple resources, you will need to either deploy it into a full Java EE
|
||||
* multiple resources, you will need to either deploy it into a full Jakarta EE
|
||||
* application server and access the deployed EntityManagerFactory via JNDI,
|
||||
* or use Spring's {@link LocalContainerEntityManagerFactoryBean} with appropriate
|
||||
* configuration for local setup according to JPA's container contract.
|
||||
@@ -65,15 +65,15 @@ import javax.persistence.spi.PersistenceProvider;
|
||||
* @see LocalContainerEntityManagerFactoryBean
|
||||
* @see org.springframework.jndi.JndiObjectFactoryBean
|
||||
* @see org.springframework.orm.jpa.support.SharedEntityManagerBean
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory
|
||||
* @see javax.persistence.spi.PersistenceProvider#createEntityManagerFactory
|
||||
* @see jakarta.persistence.Persistence#createEntityManagerFactory
|
||||
* @see jakarta.persistence.spi.PersistenceProvider#createEntityManagerFactory
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean {
|
||||
|
||||
/**
|
||||
* Initialize the EntityManagerFactory for the given configuration.
|
||||
* @throws javax.persistence.PersistenceException in case of JPA initialization errors
|
||||
* @throws jakarta.persistence.PersistenceException in case of JPA initialization errors
|
||||
*/
|
||||
@Override
|
||||
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
|
||||
|
||||
@@ -28,13 +28,12 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.StoredProcedureQuery;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.ParameterMode;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.StoredProcedureQuery;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -45,8 +44,8 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
|
||||
/**
|
||||
* Delegate for creating a shareable JPA {@link javax.persistence.EntityManager}
|
||||
* reference for a given {@link javax.persistence.EntityManagerFactory}.
|
||||
* Delegate for creating a shareable JPA {@link jakarta.persistence.EntityManager}
|
||||
* reference for a given {@link jakarta.persistence.EntityManagerFactory}.
|
||||
*
|
||||
* <p>A shared EntityManager will behave just like an EntityManager fetched from
|
||||
* an application server's JNDI environment, as defined by the JPA specification.
|
||||
@@ -54,17 +53,17 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
* otherwise it will fall back to a newly created EntityManager per operation.
|
||||
*
|
||||
* <p>For a behavioral definition of such a shared transactional EntityManager,
|
||||
* see {@link javax.persistence.PersistenceContextType#TRANSACTION} and its
|
||||
* see {@link jakarta.persistence.PersistenceContextType#TRANSACTION} and its
|
||||
* discussion in the JPA spec document. This is also the default being used
|
||||
* for the annotation-based {@link javax.persistence.PersistenceContext#type()}.
|
||||
* for the annotation-based {@link jakarta.persistence.PersistenceContext#type()}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Rod Johnson
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @since 2.0
|
||||
* @see javax.persistence.PersistenceContext
|
||||
* @see javax.persistence.PersistenceContextType#TRANSACTION
|
||||
* @see jakarta.persistence.PersistenceContext
|
||||
* @see jakarta.persistence.PersistenceContextType#TRANSACTION
|
||||
* @see org.springframework.orm.jpa.JpaTransactionManager
|
||||
* @see ExtendedEntityManagerCreator
|
||||
*/
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.orm.jpa.persistenceunit;
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import javax.persistence.spi.ClassTransformer;
|
||||
|
||||
import jakarta.persistence.spi.ClassTransformer;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -35,7 +34,7 @@ import org.springframework.util.Assert;
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer)
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#addTransformer(jakarta.persistence.spi.ClassTransformer)
|
||||
*/
|
||||
class ClassFileTransformerAdapter implements ClassFileTransformer {
|
||||
|
||||
|
||||
@@ -26,16 +26,16 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Converter;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.Converter;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.SharedCacheMode;
|
||||
import jakarta.persistence.ValidationMode;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -274,7 +274,7 @@ public class DefaultPersistenceUnitManager
|
||||
* Specify the JPA 2.0 shared cache mode for all of this manager's persistence
|
||||
* units, overriding any value in {@code persistence.xml} if set.
|
||||
* @since 4.0
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()
|
||||
*/
|
||||
public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
|
||||
this.sharedCacheMode = sharedCacheMode;
|
||||
@@ -284,7 +284,7 @@ public class DefaultPersistenceUnitManager
|
||||
* Specify the JPA 2.0 validation mode for all of this manager's persistence
|
||||
* units, overriding any value in {@code persistence.xml} if set.
|
||||
* @since 4.0
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getValidationMode()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getValidationMode()
|
||||
*/
|
||||
public void setValidationMode(ValidationMode validationMode) {
|
||||
this.validationMode = validationMode;
|
||||
@@ -341,7 +341,7 @@ public class DefaultPersistenceUnitManager
|
||||
* <p>In JPA speak, a DataSource passed in here will be uses as "nonJtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
|
||||
* none has been registered before.
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
|
||||
*/
|
||||
public void setDefaultDataSource(@Nullable DataSource defaultDataSource) {
|
||||
this.defaultDataSource = defaultDataSource;
|
||||
@@ -363,7 +363,7 @@ public class DefaultPersistenceUnitManager
|
||||
* <p>In JPA speak, a DataSource passed in here will be uses as "jtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
|
||||
* none has been registered before.
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
|
||||
*/
|
||||
public void setDefaultJtaDataSource(@Nullable DataSource defaultJtaDataSource) {
|
||||
this.defaultJtaDataSource = defaultJtaDataSource;
|
||||
|
||||
@@ -21,19 +21,20 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.ClassTransformer;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.SharedCacheMode;
|
||||
import jakarta.persistence.ValidationMode;
|
||||
import jakarta.persistence.spi.ClassTransformer;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Spring's base implementation of the JPA
|
||||
* {@link javax.persistence.spi.PersistenceUnitInfo} interface,
|
||||
* {@link jakarta.persistence.spi.PersistenceUnitInfo} interface,
|
||||
* used to bootstrap an {@code EntityManagerFactory} in a container.
|
||||
*
|
||||
* <p>This implementation is largely a JavaBean, offering mutators
|
||||
@@ -171,7 +172,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
|
||||
/**
|
||||
* Add a managed class name to the persistence provider's metadata.
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getManagedClassNames()
|
||||
* @see jakarta.persistence.spi.PersistenceUnitInfo#getManagedClassNames()
|
||||
* @see #addManagedPackage
|
||||
*/
|
||||
public void addManagedClassName(String managedClassName) {
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package org.springframework.orm.jpa.persistenceunit;
|
||||
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
/**
|
||||
* Interface that defines an abstraction for finding and managing
|
||||
* JPA PersistenceUnitInfos. Used by
|
||||
* {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean}
|
||||
* in order to obtain a {@link javax.persistence.spi.PersistenceUnitInfo}
|
||||
* for building a concrete {@link javax.persistence.EntityManagerFactory}.
|
||||
* in order to obtain a {@link jakarta.persistence.spi.PersistenceUnitInfo}
|
||||
* for building a concrete {@link jakarta.persistence.EntityManagerFactory}.
|
||||
*
|
||||
* <p>Obtaining a PersistenceUnitInfo instance is an exclusive process.
|
||||
* A PersistenceUnitInfo instance is not available for further calls
|
||||
|
||||
@@ -22,13 +22,13 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import jakarta.persistence.SharedCacheMode;
|
||||
import jakarta.persistence.ValidationMode;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.orm.jpa.persistenceunit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
/**
|
||||
* Extension of the standard JPA PersistenceUnitInfo interface, for advanced collaboration
|
||||
@@ -42,7 +42,7 @@ public interface SmartPersistenceUnitInfo extends PersistenceUnitInfo {
|
||||
|
||||
/**
|
||||
* Set the persistence provider's own package name, for exclusion from class transformation.
|
||||
* @see #addTransformer(javax.persistence.spi.ClassTransformer)
|
||||
* @see #addTransformer(jakarta.persistence.spi.ClassTransformer)
|
||||
* @see #getNewTempClassLoader()
|
||||
*/
|
||||
void setPersistenceProviderPackageName(String persistenceProviderPackageName);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa.persistenceunit;
|
||||
|
||||
import javax.persistence.spi.ClassTransformer;
|
||||
import jakarta.persistence.spi.ClassTransformer;
|
||||
|
||||
import org.springframework.core.DecoratingClassLoader;
|
||||
import org.springframework.instrument.classloading.LoadTimeWeaver;
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.orm.jpa.support;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.orm.jpa.support;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -242,7 +242,7 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter {
|
||||
* Create a JPA EntityManager to be bound to a request.
|
||||
* <p>Can be overridden in subclasses.
|
||||
* @param emf the EntityManagerFactory to use
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager()
|
||||
* @see jakarta.persistence.EntityManagerFactory#createEntityManager()
|
||||
*/
|
||||
protected EntityManager createEntityManager(EntityManagerFactory emf) {
|
||||
return emf.createEntityManager();
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.orm.jpa.support;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
|
||||
@@ -29,13 +29,13 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceContextType;
|
||||
import javax.persistence.PersistenceProperty;
|
||||
import javax.persistence.PersistenceUnit;
|
||||
import javax.persistence.SynchronizationType;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.PersistenceContextType;
|
||||
import jakarta.persistence.PersistenceProperty;
|
||||
import jakarta.persistence.PersistenceUnit;
|
||||
import jakarta.persistence.SynchronizationType;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
@@ -71,10 +71,10 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* BeanPostProcessor that processes {@link javax.persistence.PersistenceUnit}
|
||||
* and {@link javax.persistence.PersistenceContext} annotations, for injection of
|
||||
* the corresponding JPA resources {@link javax.persistence.EntityManagerFactory}
|
||||
* and {@link javax.persistence.EntityManager}. Any such annotated fields or methods
|
||||
* BeanPostProcessor that processes {@link jakarta.persistence.PersistenceUnit}
|
||||
* and {@link jakarta.persistence.PersistenceContext} annotations, for injection of
|
||||
* the corresponding JPA resources {@link jakarta.persistence.EntityManagerFactory}
|
||||
* and {@link jakarta.persistence.EntityManager}. Any such annotated fields or methods
|
||||
* in any Spring-managed object will automatically be injected.
|
||||
*
|
||||
* <p>This post-processor will inject sub-interfaces of {@code EntityManagerFactory}
|
||||
@@ -88,7 +88,7 @@ import org.springframework.util.StringUtils;
|
||||
* with the "unitName" attribute, or no attribute at all (for the default unit).
|
||||
* If those annotations are present with the "name" attribute at the class level,
|
||||
* they will simply be ignored, since those only serve as deployment hint
|
||||
* (as per the Java EE specification).
|
||||
* (as per the Jakarta EE specification).
|
||||
*
|
||||
* <p>This post-processor can either obtain EntityManagerFactory beans defined
|
||||
* in the Spring application context (the default), or obtain EntityManagerFactory
|
||||
@@ -106,9 +106,9 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* In the JNDI case, specify the corresponding JNDI names in this post-processor's
|
||||
* {@link #setPersistenceUnits "persistenceUnits" map}, typically with matching
|
||||
* {@code persistence-unit-ref} entries in the Java EE deployment descriptor.
|
||||
* {@code persistence-unit-ref} entries in the Jakarta EE deployment descriptor.
|
||||
* By default, those names are considered as resource references (according to the
|
||||
* Java EE resource-ref convention), located underneath the "java:comp/env/" namespace.
|
||||
* Jakarta EE resource-ref convention), located underneath the "java:comp/env/" namespace.
|
||||
* For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
@@ -123,18 +123,18 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* In this case, the specified persistence units will always be resolved in JNDI
|
||||
* rather than as Spring-defined beans. The entire persistence unit deployment,
|
||||
* including the weaving of persistent classes, is then up to the Java EE server.
|
||||
* including the weaving of persistent classes, is then up to the Jakarta EE server.
|
||||
* Persistence contexts (i.e. EntityManager references) will be built based on
|
||||
* those server-provided EntityManagerFactory references, using Spring's own
|
||||
* transaction synchronization facilities for transactional EntityManager handling
|
||||
* (typically with Spring's {@code @Transactional} annotation for demarcation
|
||||
* and {@link org.springframework.transaction.jta.JtaTransactionManager} as backend).
|
||||
*
|
||||
* <p>If you prefer the Java EE server's own EntityManager handling, specify entries
|
||||
* <p>If you prefer the Jakarta EE server's own EntityManager handling, specify entries
|
||||
* in this post-processor's {@link #setPersistenceContexts "persistenceContexts" map}
|
||||
* (or {@link #setExtendedPersistenceContexts "extendedPersistenceContexts" map},
|
||||
* typically with matching {@code persistence-context-ref} entries in the
|
||||
* Java EE deployment descriptor. For example:
|
||||
* Jakarta EE deployment descriptor. For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
|
||||
@@ -165,8 +165,8 @@ import org.springframework.util.StringUtils;
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @see javax.persistence.PersistenceUnit
|
||||
* @see javax.persistence.PersistenceContext
|
||||
* @see jakarta.persistence.PersistenceUnit
|
||||
* @see jakarta.persistence.PersistenceContext
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PersistenceAnnotationBeanPostProcessor
|
||||
@@ -216,7 +216,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the lookup occurs in a Java EE container, i.e. if the prefix
|
||||
* Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix
|
||||
* "java:comp/env/" needs to be added if the JNDI name doesn't already
|
||||
* contain it. PersistenceAnnotationBeanPostProcessor's default is "true".
|
||||
* @see org.springframework.jndi.JndiLocatorSupport#setResourceRef
|
||||
@@ -230,12 +230,12 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* as a Map from persistence unit name to persistence unit JNDI name
|
||||
* (which needs to resolve to an EntityManagerFactory instance).
|
||||
* <p>JNDI names specified here should refer to {@code persistence-unit-ref}
|
||||
* entries in the Java EE deployment descriptor, matching the target persistence unit.
|
||||
* entries in the Jakarta EE deployment descriptor, matching the target persistence unit.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
* will be taken (by default, the value mapped to the empty String),
|
||||
* or simply the single persistence unit if there is only one.
|
||||
* <p>This is mainly intended for use in a Java EE environment, with all lookup
|
||||
* <p>This is mainly intended for use in a Jakarta EE environment, with all lookup
|
||||
* driven by the standard JPA annotations, and all EntityManagerFactory
|
||||
* references obtained from JNDI. No separate EntityManagerFactory bean
|
||||
* definitions are necessary in such a scenario.
|
||||
@@ -244,7 +244,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* EntityManagers built on top of the EntityManagerFactory defined here.
|
||||
* Note that those will be Spring-managed EntityManagers, which implement
|
||||
* transaction synchronization based on Spring's facilities.
|
||||
* If you prefer the Java EE server's own EntityManager handling,
|
||||
* If you prefer the Jakarta EE server's own EntityManager handling,
|
||||
* specify corresponding "persistenceContexts"/"extendedPersistenceContexts".
|
||||
*/
|
||||
public void setPersistenceUnits(Map<String, String> persistenceUnits) {
|
||||
@@ -256,17 +256,17 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* as a Map from persistence unit name to persistence context JNDI name
|
||||
* (which needs to resolve to an EntityManager instance).
|
||||
* <p>JNDI names specified here should refer to {@code persistence-context-ref}
|
||||
* entries in the Java EE deployment descriptors, matching the target persistence unit
|
||||
* entries in the Jakarta EE deployment descriptors, matching the target persistence unit
|
||||
* and being set up with persistence context type {@code Transaction}.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
* will be taken (by default, the value mapped to the empty String),
|
||||
* or simply the single persistence unit if there is only one.
|
||||
* <p>This is mainly intended for use in a Java EE environment, with all
|
||||
* <p>This is mainly intended for use in a Jakarta EE environment, with all
|
||||
* lookup driven by the standard JPA annotations, and all EntityManager
|
||||
* references obtained from JNDI. No separate EntityManagerFactory bean
|
||||
* definitions are necessary in such a scenario, and all EntityManager
|
||||
* handling is done by the Java EE server itself.
|
||||
* handling is done by the Jakarta EE server itself.
|
||||
*/
|
||||
public void setPersistenceContexts(Map<String, String> persistenceContexts) {
|
||||
this.persistenceContexts = persistenceContexts;
|
||||
@@ -277,17 +277,17 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* as a Map from persistence unit name to persistence context JNDI name
|
||||
* (which needs to resolve to an EntityManager instance).
|
||||
* <p>JNDI names specified here should refer to {@code persistence-context-ref}
|
||||
* entries in the Java EE deployment descriptors, matching the target persistence unit
|
||||
* entries in the Jakarta EE deployment descriptors, matching the target persistence unit
|
||||
* and being set up with persistence context type {@code Extended}.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
* will be taken (by default, the value mapped to the empty String),
|
||||
* or simply the single persistence unit if there is only one.
|
||||
* <p>This is mainly intended for use in a Java EE environment, with all
|
||||
* <p>This is mainly intended for use in a Jakarta EE environment, with all
|
||||
* lookup driven by the standard JPA annotations, and all EntityManager
|
||||
* references obtained from JNDI. No separate EntityManagerFactory bean
|
||||
* definitions are necessary in such a scenario, and all EntityManager
|
||||
* handling is done by the Java EE server itself.
|
||||
* handling is done by the Jakarta EE server itself.
|
||||
*/
|
||||
public void setExtendedPersistenceContexts(Map<String, String> extendedPersistenceContexts) {
|
||||
this.extendedPersistenceContexts = extendedPersistenceContexts;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.orm.jpa.support;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -28,10 +28,10 @@ import org.springframework.orm.jpa.SharedEntityManagerCreator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link FactoryBean} that exposes a shared JPA {@link javax.persistence.EntityManager}
|
||||
* {@link FactoryBean} that exposes a shared JPA {@link jakarta.persistence.EntityManager}
|
||||
* reference for a given EntityManagerFactory. Typically used for an EntityManagerFactory
|
||||
* created by {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean},
|
||||
* as direct alternative to a JNDI lookup for a Java EE server's EntityManager reference.
|
||||
* as direct alternative to a JNDI lookup for a Jakarta EE server's EntityManager reference.
|
||||
*
|
||||
* <p>The shared EntityManager will behave just like an EntityManager fetched from an
|
||||
* application server's JNDI environment, as defined by the JPA specification.
|
||||
@@ -65,9 +65,9 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
|
||||
* Specify the EntityManager interface to expose.
|
||||
* <p>Default is the EntityManager interface as defined by the
|
||||
* EntityManagerFactoryInfo, if available. Else, the standard
|
||||
* {@code javax.persistence.EntityManager} interface will be used.
|
||||
* {@code jakarta.persistence.EntityManager} interface will be used.
|
||||
* @see org.springframework.orm.jpa.EntityManagerFactoryInfo#getEntityManagerInterface()
|
||||
* @see javax.persistence.EntityManager
|
||||
* @see jakarta.persistence.EntityManager
|
||||
*/
|
||||
public void setEntityManagerInterface(Class<? extends EntityManager> entityManagerInterface) {
|
||||
Assert.notNull(entityManagerInterface, "'entityManagerInterface' must not be null");
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.orm.jpa.vendor;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.jpa.JpaDialect;
|
||||
@@ -89,7 +89,7 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
|
||||
* persistence provider. For any more advanced needs, specify the appropriate
|
||||
* vendor-specific settings as "jpaProperties".
|
||||
* <p><b>NOTE: Do not set this flag to 'true' while also setting JPA 2.1's
|
||||
* {@code javax.persistence.schema-generation.database.action} property.</b>
|
||||
* {@code jakarta.persistence.schema-generation.database.action} property.</b>
|
||||
* These two schema generation mechanisms - standard JPA versus provider-native -
|
||||
* are mutually exclusive, e.g. with Hibernate 5.
|
||||
* @see org.springframework.orm.jpa.AbstractEntityManagerFactoryBean#setJpaProperties
|
||||
|
||||
@@ -19,9 +19,8 @@ package org.springframework.orm.jpa.vendor;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.eclipse.persistence.sessions.UnitOfWork;
|
||||
|
||||
import org.springframework.jdbc.datasource.ConnectionHandle;
|
||||
|
||||
@@ -20,9 +20,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
||||
import org.eclipse.persistence.config.TargetDatabase;
|
||||
import org.eclipse.persistence.jpa.JpaEntityManager;
|
||||
|
||||
@@ -19,9 +19,8 @@ package org.springframework.orm.jpa.vendor;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.orm.jpa.vendor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
@@ -19,12 +19,11 @@ package org.springframework.orm.jpa.vendor;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
|
||||
@@ -20,9 +20,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
|
||||
|
||||
@@ -19,11 +19,10 @@ package org.springframework.orm.jpa;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.FlushModeType;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.FlushModeType;
|
||||
import jakarta.persistence.NoResultException;
|
||||
import jakarta.persistence.Query;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.testfixture.io.SerializationTestUtils;
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.Query;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.Query;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
@@ -19,10 +19,9 @@ package org.springframework.orm.jpa;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.orm.jpa.domain.Person;
|
||||
|
||||
@@ -19,11 +19,10 @@ package org.springframework.orm.jpa;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
|
||||
@@ -16,16 +16,15 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityExistsException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityExistsException;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.NoResultException;
|
||||
import jakarta.persistence.NonUniqueResultException;
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
@@ -19,11 +19,10 @@ package org.springframework.orm.jpa;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.RollbackException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.RollbackException;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -19,16 +19,15 @@ package org.springframework.orm.jpa;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
import javax.persistence.spi.ProviderUtil;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
import jakarta.persistence.spi.ProviderUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
|
||||
@@ -19,11 +19,10 @@ package org.springframework.orm.jpa;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.spi.PersistenceProvider;
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.ProviderUtil;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.spi.PersistenceProvider;
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.ProviderUtil;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
package org.springframework.orm.jpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.StoredProcedureQuery;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.ParameterMode;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.persistence.StoredProcedureQuery;
|
||||
import jakarta.persistence.TransactionRequiredException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.orm.jpa.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="DRIVERS_LICENSE")
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
package org.springframework.orm.jpa.domain;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityListeners;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EntityListeners;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
|
||||
import org.springframework.beans.testfixture.beans.TestBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa.domain;
|
||||
|
||||
import javax.persistence.PostLoad;
|
||||
import jakarta.persistence.PostLoad;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa.hibernate;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.orm.jpa.hibernate;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
package org.springframework.orm.jpa.hibernate;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.resource.beans.container.spi.BeanContainer;
|
||||
import org.hibernate.resource.beans.container.spi.ContainedBean;
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.spi.PersistenceUnitInfo;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.spi.PersistenceUnitInfo;
|
||||
import jakarta.persistence.spi.PersistenceUnitTransactionType;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
@@ -21,12 +21,11 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.servlet.AsyncEvent;
|
||||
import javax.servlet.AsyncListener;
|
||||
import javax.servlet.FilterChain;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.servlet.AsyncEvent;
|
||||
import jakarta.servlet.AsyncListener;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
package org.springframework.orm.jpa.support;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceContextType;
|
||||
import javax.persistence.SynchronizationType;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityTransaction;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.PersistenceContextType;
|
||||
import jakarta.persistence.SynchronizationType;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -24,13 +24,12 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceContextType;
|
||||
import javax.persistence.PersistenceProperty;
|
||||
import javax.persistence.PersistenceUnit;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.PersistenceContextType;
|
||||
import jakarta.persistence.PersistenceProperty;
|
||||
import jakarta.persistence.PersistenceUnit;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.orm.jpa.support;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.orm.jpa.EntityManagerHolder;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.orm.jpa.domain.Person=javax.persistence.Entity
|
||||
org.springframework.orm.jpa.domain.DriversLicense=javax.persistence.Entity
|
||||
org.springframework.orm.jpa.domain.Person=jakarta.persistence.Entity
|
||||
org.springframework.orm.jpa.domain.DriversLicense=jakarta.persistence.Entity
|
||||
@@ -28,6 +28,6 @@
|
||||
|
||||
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
|
||||
|
||||
<bean id="invalid" class="javax.persistence.AttributeConverter" lazy-init="true"/>
|
||||
<bean id="invalid" class="jakarta.persistence.AttributeConverter" lazy-init="true"/>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user