From ea199bc9b26c811bce1f0d73706a237cda9c1366 Mon Sep 17 00:00:00 2001 From: Oswald Quek Date: Wed, 29 Sep 2021 13:41:03 +0100 Subject: [PATCH] Upgrade hibernate version to support JPA 3.0 --- extensions/persist/pom.xml | 10 ++++------ .../com/google/inject/persist/jpa/JpaFinderProxy.java | 4 ++-- .../inject/persist/jpa/JpaLocalTxnInterceptor.java | 4 ++-- .../google/inject/persist/jpa/JpaPersistModule.java | 4 ++-- .../google/inject/persist/jpa/JpaPersistService.java | 6 +++--- .../jpa/ClassLevelManagedLocalTransactionsTest.java | 2 +- .../CustomPropsEntityManagerFactoryProvisionTest.java | 4 ++-- .../google/inject/persist/jpa/DynamicFinderTest.java | 2 +- .../jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java | 8 ++++---- .../persist/jpa/EntityManagerFactoryProvisionTest.java | 4 ++-- .../jpa/EntityManagerPerRequestProvisionTest.java | 4 ++-- .../inject/persist/jpa/EntityManagerProvisionTest.java | 4 ++-- .../persist/jpa/JoiningLocalTransactionsTest.java | 6 +++--- .../google/inject/persist/jpa/JpaParentTestEntity.java | 8 ++++---- .../inject/persist/jpa/JpaPersistServiceTest.java | 6 +++--- .../com/google/inject/persist/jpa/JpaTestEntity.java | 6 +++--- .../google/inject/persist/jpa/JpaWorkManagerTest.java | 6 +++--- .../jpa/ManagedLocalTransactionsAcrossRequestTest.java | 6 +++--- .../persist/jpa/ManagedLocalTransactionsTest.java | 6 +++--- .../jpa/ManualLocalTransactionsConfidenceTest.java | 4 ++-- .../persist/jpa/ManualLocalTransactionsTest.java | 4 ++-- .../ManualLocalTransactionsWithCustomMatcherTest.java | 4 ++-- 22 files changed, 55 insertions(+), 57 deletions(-) diff --git a/extensions/persist/pom.xml b/extensions/persist/pom.xml index 2269448148..3aa4b7a54a 100644 --- a/extensions/persist/pom.xml +++ b/extensions/persist/pom.xml @@ -15,10 +15,9 @@ - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.0.Final - provided + org.hibernate + hibernate-core-jakarta + 5.5.7.Final javax.servlet @@ -35,8 +34,7 @@ org.hibernate hibernate-entitymanager - 4.1.7.Final - test + 5.5.6.Final org.hsqldb diff --git a/extensions/persist/src/com/google/inject/persist/jpa/JpaFinderProxy.java b/extensions/persist/src/com/google/inject/persist/jpa/JpaFinderProxy.java index e37ddca199..0642d1c67b 100644 --- a/extensions/persist/src/com/google/inject/persist/jpa/JpaFinderProxy.java +++ b/extensions/persist/src/com/google/inject/persist/jpa/JpaFinderProxy.java @@ -31,8 +31,8 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import javax.persistence.EntityManager; -import javax.persistence.Query; +import jakarta.persistence.EntityManager; +import jakarta.persistence.Query; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; diff --git a/extensions/persist/src/com/google/inject/persist/jpa/JpaLocalTxnInterceptor.java b/extensions/persist/src/com/google/inject/persist/jpa/JpaLocalTxnInterceptor.java index bd5525dcf2..20cd92147d 100644 --- a/extensions/persist/src/com/google/inject/persist/jpa/JpaLocalTxnInterceptor.java +++ b/extensions/persist/src/com/google/inject/persist/jpa/JpaLocalTxnInterceptor.java @@ -20,8 +20,8 @@ import com.google.inject.persist.Transactional; import com.google.inject.persist.UnitOfWork; import java.lang.reflect.Method; -import javax.persistence.EntityManager; -import javax.persistence.EntityTransaction; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityTransaction; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; diff --git a/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistModule.java b/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistModule.java index 6ff74ad5c6..3655218655 100644 --- a/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistModule.java +++ b/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistModule.java @@ -32,8 +32,8 @@ import java.lang.reflect.Proxy; import java.util.List; import java.util.Map; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; diff --git a/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistService.java b/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistService.java index 5396f95155..e8c28b9bd8 100644 --- a/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistService.java +++ b/extensions/persist/src/com/google/inject/persist/jpa/JpaPersistService.java @@ -29,9 +29,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Map; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.Persistence; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ @Singleton diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java index 103d0bb5ce..d0941cbf3f 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java @@ -25,7 +25,7 @@ import java.io.IOException; import java.util.Date; import java.util.List; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import junit.framework.TestCase; /** diff --git a/extensions/persist/test/com/google/inject/persist/jpa/CustomPropsEntityManagerFactoryProvisionTest.java b/extensions/persist/test/com/google/inject/persist/jpa/CustomPropsEntityManagerFactoryProvisionTest.java index 7f1cd712ad..d395078add 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/CustomPropsEntityManagerFactoryProvisionTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/CustomPropsEntityManagerFactoryProvisionTest.java @@ -21,8 +21,8 @@ import com.google.inject.persist.PersistService; import com.google.inject.persist.UnitOfWork; import java.util.Properties; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/DynamicFinderTest.java b/extensions/persist/test/com/google/inject/persist/jpa/DynamicFinderTest.java index f6fe254fcf..2ef38421e2 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/DynamicFinderTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/DynamicFinderTest.java @@ -27,7 +27,7 @@ import java.util.Date; import java.util.List; import java.util.UUID; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import junit.framework.TestCase; /** diff --git a/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java b/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java index 1318b6303a..666455d621 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java @@ -23,14 +23,14 @@ import junit.framework.TestCase; import org.hibernate.cfg.Environment; -import org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider; +import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl; import org.hsqldb.jdbc.JDBCDataSource; import java.util.HashMap; import java.util.Map; -import javax.persistence.EntityManagerFactory; -import javax.persistence.PersistenceException; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.PersistenceException; import javax.sql.DataSource; public class EnsureJpaCanTakeObjectsInPropertiesTest extends TestCase { @@ -51,7 +51,7 @@ public static class DBModule extends AbstractModule { protected void configure() { Map p = new HashMap<>(); - p.put(Environment.CONNECTION_PROVIDER, InjectedDataSourceConnectionProvider.class.getName()); + p.put(Environment.CONNECTION_PROVIDER, DatasourceConnectionProviderImpl.class.getName()); if (passDataSource) { p.put(Environment.DATASOURCE, ds); } diff --git a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerFactoryProvisionTest.java b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerFactoryProvisionTest.java index 73bc7c95c4..3cec275c01 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerFactoryProvisionTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerFactoryProvisionTest.java @@ -20,8 +20,8 @@ import com.google.inject.Injector; import com.google.inject.persist.PersistService; import com.google.inject.persist.UnitOfWork; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerPerRequestProvisionTest.java b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerPerRequestProvisionTest.java index 8d6582dd07..433afe9d76 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerPerRequestProvisionTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerPerRequestProvisionTest.java @@ -22,8 +22,8 @@ import com.google.inject.persist.PersistService; import com.google.inject.persist.Transactional; import com.google.inject.persist.UnitOfWork; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /** diff --git a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerProvisionTest.java b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerProvisionTest.java index b432d4b6bd..d8b030e20d 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerProvisionTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/EntityManagerProvisionTest.java @@ -22,8 +22,8 @@ import com.google.inject.Provider; import com.google.inject.persist.PersistService; import com.google.inject.persist.Transactional; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /** diff --git a/extensions/persist/test/com/google/inject/persist/jpa/JoiningLocalTransactionsTest.java b/extensions/persist/test/com/google/inject/persist/jpa/JoiningLocalTransactionsTest.java index ecd48badbd..7f6ed403eb 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/JoiningLocalTransactionsTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/JoiningLocalTransactionsTest.java @@ -24,9 +24,9 @@ import com.google.inject.persist.UnitOfWork; import java.io.IOException; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NoResultException; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.NoResultException; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/JpaParentTestEntity.java b/extensions/persist/test/com/google/inject/persist/jpa/JpaParentTestEntity.java index c100883ad3..f6382c6f61 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/JpaParentTestEntity.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/JpaParentTestEntity.java @@ -18,10 +18,10 @@ import java.util.ArrayList; import java.util.List; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.OneToMany; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; /** * Created with IntelliJ IDEA. On: 2/06/2007 diff --git a/extensions/persist/test/com/google/inject/persist/jpa/JpaPersistServiceTest.java b/extensions/persist/test/com/google/inject/persist/jpa/JpaPersistServiceTest.java index 67b9288cf4..b1531cf0ef 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/JpaPersistServiceTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/JpaPersistServiceTest.java @@ -23,9 +23,9 @@ import static org.mockito.Mockito.when; import java.util.Properties; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.spi.PersistenceProvider; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.spi.PersistenceProvider; import junit.framework.TestCase; public class JpaPersistServiceTest extends TestCase { diff --git a/extensions/persist/test/com/google/inject/persist/jpa/JpaTestEntity.java b/extensions/persist/test/com/google/inject/persist/jpa/JpaTestEntity.java index 4d8993a2b7..b7804b8d43 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/JpaTestEntity.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/JpaTestEntity.java @@ -16,9 +16,9 @@ package com.google.inject.persist.jpa; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ @Entity diff --git a/extensions/persist/test/com/google/inject/persist/jpa/JpaWorkManagerTest.java b/extensions/persist/test/com/google/inject/persist/jpa/JpaWorkManagerTest.java index c9b6fe912c..abc4f3928d 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/JpaWorkManagerTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/JpaWorkManagerTest.java @@ -23,9 +23,9 @@ import com.google.inject.persist.Transactional; import com.google.inject.persist.UnitOfWork; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Query; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.Query; import junit.framework.TestCase; import org.hibernate.HibernateException; diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsAcrossRequestTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsAcrossRequestTest.java index 1c31fe41d5..1f607eb841 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsAcrossRequestTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsAcrossRequestTest.java @@ -26,9 +26,9 @@ import com.google.inject.persist.finder.Finder; import java.io.IOException; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NoResultException; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.NoResultException; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsTest.java index 167d6a4c14..2d5858d9d7 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ManagedLocalTransactionsTest.java @@ -24,9 +24,9 @@ import com.google.inject.persist.UnitOfWork; import java.io.IOException; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NoResultException; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.NoResultException; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsConfidenceTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsConfidenceTest.java index cad873481e..ecee35a2e3 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsConfidenceTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsConfidenceTest.java @@ -22,8 +22,8 @@ import com.google.inject.persist.PersistService; import com.google.inject.persist.Transactional; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceException; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceException; import junit.framework.TestCase; /** @author Dhanji R. Prasanna (dhanji@gmail.com) */ diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsTest.java index 2d04be7f64..1458f2fc69 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsTest.java @@ -23,8 +23,8 @@ import com.google.inject.persist.Transactional; import com.google.inject.persist.UnitOfWork; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /** diff --git a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsWithCustomMatcherTest.java b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsWithCustomMatcherTest.java index 41991f5aed..321a12173d 100644 --- a/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsWithCustomMatcherTest.java +++ b/extensions/persist/test/com/google/inject/persist/jpa/ManualLocalTransactionsWithCustomMatcherTest.java @@ -23,8 +23,8 @@ import com.google.inject.persist.Transactional; import com.google.inject.persist.UnitOfWork; import java.util.Date; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import junit.framework.TestCase; /**