Skip to content

Commit a2fb100

Browse files
committed
Fixing execution of tinder plugin step, removing deprecated calls
1 parent 0c169b5 commit a2fb100

File tree

17 files changed

+160
-92
lines changed

17 files changed

+160
-92
lines changed

hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirDerbyDialect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/**
2727
* Dialect for Derby database.
28-
* Minimum version: 10.14.2
28+
* Minimum version: 10.15.2
2929
*/
3030
public class HapiFhirDerbyDialect extends DerbyDialect implements IHapiFhirDialect {
3131

hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiSequenceStyleGenerator.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
55
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
66
import org.apache.commons.lang3.Validate;
77
import org.hibernate.HibernateException;
8-
import org.hibernate.MappingException;
98
import org.hibernate.boot.model.relational.Database;
109
import org.hibernate.boot.model.relational.ExportableProducer;
1110
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
1211
import org.hibernate.engine.spi.SharedSessionContractImplementor;
12+
import org.hibernate.generator.GeneratorCreationContext;
1313
import org.hibernate.id.BulkInsertionCapableIdentifierGenerator;
1414
import org.hibernate.id.IdentifierGenerator;
1515
import org.hibernate.id.OptimizableGenerator;
1616
import org.hibernate.id.PersistentIdentifierGenerator;
1717
import org.hibernate.id.enhanced.Optimizer;
1818
import org.hibernate.id.enhanced.SequenceStyleGenerator;
1919
import org.hibernate.id.enhanced.StandardOptimizerDescriptor;
20-
import org.hibernate.service.ServiceRegistry;
21-
import org.hibernate.type.Type;
2220

2321
import java.io.Serializable;
2422
import java.util.Properties;
@@ -68,27 +66,22 @@ public Serializable generate(SharedSessionContractImplementor theSession, Object
6866
return retVal;
6967
}
7068

71-
// Hibernate 7.1.1 still calls this, but it is deprecated; suppress warnings and delegate.
72-
@SuppressWarnings({"removal", "deprecation"})
7369
@Override
74-
public void configure(Type theType, Properties theParams, ServiceRegistry theServiceRegistry)
75-
throws MappingException {
76-
77-
myIdMassager = theServiceRegistry.getService(ISequenceValueMassager.class);
70+
public void configure(GeneratorCreationContext creationContext, Properties parameters) {
71+
myIdMassager = creationContext.getServiceRegistry().getService(ISequenceValueMassager.class);
7872
if (myIdMassager == null) {
7973
myIdMassager = new ISequenceValueMassager.NoopSequenceValueMassager();
8074
}
81-
82-
myGeneratorName = theParams.getProperty(IdentifierGenerator.GENERATOR_NAME);
75+
myGeneratorName = parameters.getProperty(IdentifierGenerator.GENERATOR_NAME);
8376
Validate.notBlank(myGeneratorName, "No generator name found");
8477

85-
Properties props = new Properties(theParams);
78+
Properties props = new Properties(parameters);
8679
props.put(OptimizableGenerator.OPT_PARAM, StandardOptimizerDescriptor.POOLED.getExternalName());
8780
props.put(OptimizableGenerator.INITIAL_PARAM, "1");
8881
props.put(OptimizableGenerator.INCREMENT_PARAM, "50");
8982
props.put(IdentifierGenerator.GENERATOR_NAME, myGeneratorName);
9083

91-
myGen.configure(theType, props, theServiceRegistry);
84+
myGen.configure(creationContext, props);
9285
myConfigured = true;
9386
}
9487

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BasePartitioningR4Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void after() {
7474
myPartitionSettings.setAllowReferencesAcrossPartitions(defaultPartitionSettings.getAllowReferencesAcrossPartitions());
7575
myPartitionSettings.setDefaultPartitionId(defaultPartitionSettings.getDefaultPartitionId());
7676

77-
mySrdInterceptorService.unregisterInterceptorsIf(t -> t instanceof MyReadWriteInterceptor);
77+
mySrdInterceptorService.unregisterInterceptorsIf(MyReadWriteInterceptor.class::isInstance);
7878

7979
myStorageSettings.setIndexMissingFields(defaultStorageSettings.getIndexMissingFields());
8080
myStorageSettings.setAutoCreatePlaceholderReferenceTargets(defaultStorageSettings.isAutoCreatePlaceholderReferenceTargets());

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningAllowedUnqualifiedR4Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public void beforeEach() {
2323
@AfterEach
2424
@Override
2525
public void after() {
26+
2627
PartitionSettings defaultPartitionSettings = new PartitionSettings();
2728
myPartitionSettings.setIncludePartitionInSearchHashes(defaultPartitionSettings.isIncludePartitionInSearchHashes());
2829
myPartitionSettings.setPartitioningEnabled(defaultPartitionSettings.isPartitioningEnabled());
2930
myPartitionSettings.setAllowReferencesAcrossPartitions(defaultPartitionSettings.getAllowReferencesAcrossPartitions());
3031
myPartitionSettings.setDefaultPartitionId(defaultPartitionSettings.getDefaultPartitionId());
3132

3233
mySrdInterceptorService.unregisterInterceptorsIf(MyReadWriteInterceptor.class::isInstance);
33-
3434
}
3535

3636
@Test

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,27 @@
5555
import com.google.common.collect.Lists;
5656
import jakarta.annotation.Nonnull;
5757
import jakarta.annotation.Nullable;
58+
import jakarta.persistence.CacheRetrieveMode;
59+
import jakarta.persistence.CacheStoreMode;
60+
import jakarta.persistence.ConnectionConsumer;
61+
import jakarta.persistence.ConnectionFunction;
5862
import jakarta.persistence.EntityGraph;
5963
import jakarta.persistence.EntityManager;
6064
import jakarta.persistence.EntityManagerFactory;
6165
import jakarta.persistence.EntityTransaction;
66+
import jakarta.persistence.FindOption;
6267
import jakarta.persistence.FlushModeType;
6368
import jakarta.persistence.LockModeType;
69+
import jakarta.persistence.LockOption;
6470
import jakarta.persistence.Query;
71+
import jakarta.persistence.RefreshOption;
6572
import jakarta.persistence.StoredProcedureQuery;
6673
import jakarta.persistence.TypedQuery;
74+
import jakarta.persistence.TypedQueryReference;
6775
import jakarta.persistence.criteria.CriteriaBuilder;
6876
import jakarta.persistence.criteria.CriteriaDelete;
6977
import jakarta.persistence.criteria.CriteriaQuery;
78+
import jakarta.persistence.criteria.CriteriaSelect;
7079
import jakarta.persistence.criteria.CriteriaUpdate;
7180
import jakarta.persistence.metamodel.Metamodel;
7281
import org.hibernate.internal.SessionImpl;
@@ -655,11 +664,26 @@ public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode
655664
throw new UnsupportedOperationException();
656665
}
657666

667+
@Override
668+
public <T> T find(Class<T> entityClass, Object primaryKey, FindOption... options) {
669+
throw new UnsupportedOperationException();
670+
}
671+
672+
@Override
673+
public <T> T find(EntityGraph<T> entityGraph, Object primaryKey, FindOption... options) {
674+
throw new UnsupportedOperationException();
675+
}
676+
658677
@Override
659678
public <T> T getReference(Class<T> entityClass, Object primaryKey) {
660679
throw new UnsupportedOperationException();
661680
}
662681

682+
@Override
683+
public <T> T getReference(T entity) {
684+
throw new UnsupportedOperationException();
685+
}
686+
663687
@Override
664688
public void flush() {
665689
myFlushCount++;
@@ -685,6 +709,11 @@ public void lock(Object entity, LockModeType lockMode, Map<String, Object> prope
685709
throw new UnsupportedOperationException();
686710
}
687711

712+
@Override
713+
public void lock(Object entity, LockModeType lockMode, LockOption... options) {
714+
throw new UnsupportedOperationException();
715+
}
716+
688717
@Override
689718
public void refresh(Object entity) {
690719
throw new UnsupportedOperationException();
@@ -705,6 +734,11 @@ public void refresh(Object entity, LockModeType lockMode, Map<String, Object> pr
705734
throw new UnsupportedOperationException();
706735
}
707736

737+
@Override
738+
public void refresh(Object entity, RefreshOption... options) {
739+
throw new UnsupportedOperationException();
740+
}
741+
708742
@Override
709743
public void clear() {
710744
throw new UnsupportedOperationException();
@@ -725,6 +759,26 @@ public LockModeType getLockMode(Object entity) {
725759
throw new UnsupportedOperationException();
726760
}
727761

762+
@Override
763+
public void setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) {
764+
throw new UnsupportedOperationException();
765+
}
766+
767+
@Override
768+
public void setCacheStoreMode(CacheStoreMode cacheStoreMode) {
769+
throw new UnsupportedOperationException();
770+
}
771+
772+
@Override
773+
public CacheRetrieveMode getCacheRetrieveMode() {
774+
throw new UnsupportedOperationException();
775+
}
776+
777+
@Override
778+
public CacheStoreMode getCacheStoreMode() {
779+
throw new UnsupportedOperationException();
780+
}
781+
728782
@Override
729783
public void setProperty(String propertyName, Object value) {
730784
throw new UnsupportedOperationException();
@@ -745,6 +799,11 @@ public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {
745799
throw new UnsupportedOperationException();
746800
}
747801

802+
@Override
803+
public <T> TypedQuery<T> createQuery(CriteriaSelect<T> selectQuery) {
804+
throw new UnsupportedOperationException();
805+
}
806+
748807
@Override
749808
public Query createQuery(CriteriaUpdate updateQuery) {
750809
throw new UnsupportedOperationException();
@@ -770,6 +829,11 @@ public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass) {
770829
throw new UnsupportedOperationException();
771830
}
772831

832+
@Override
833+
public <T> TypedQuery<T> createQuery(TypedQueryReference<T> reference) {
834+
throw new UnsupportedOperationException();
835+
}
836+
773837
@Override
774838
public Query createNativeQuery(String sqlString) {
775839
throw new UnsupportedOperationException();
@@ -878,6 +942,16 @@ public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
878942
throw new UnsupportedOperationException();
879943
}
880944

945+
@Override
946+
public <C> void runWithConnection(ConnectionConsumer<C> action) {
947+
throw new UnsupportedOperationException();
948+
}
949+
950+
@Override
951+
public <C, T> T callWithConnection(ConnectionFunction<C, T> function) {
952+
throw new UnsupportedOperationException();
953+
}
954+
881955
public void clearCounts() {
882956
myMergeCount.clear();
883957
myPersistCount.clear();
@@ -891,18 +965,18 @@ private static class MockRequestPartitionHelperSvc implements ca.uhn.fhir.jpa.pa
891965
@Nonnull
892966
@Override
893967
public RequestPartitionId determineReadPartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull ReadPartitionIdRequestDetails theDetails) {
894-
return RequestPartitionId.defaultPartition();
968+
return RequestPartitionId.allPartitions();
895969
}
896970

897971
@Override
898972
public RequestPartitionId determineGenericPartitionForRequest(RequestDetails theRequestDetails) {
899-
return RequestPartitionId.defaultPartition();
973+
return RequestPartitionId.allPartitions();
900974
}
901975

902976
@Nonnull
903977
@Override
904978
public RequestPartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType) {
905-
return RequestPartitionId.defaultPartition();
979+
return RequestPartitionId.allPartitions();
906980
}
907981

908982
@Nonnull
@@ -919,15 +993,14 @@ public boolean isResourcePartitionable(String theResourceType) {
919993

920994
@Override
921995
public RequestPartitionId validateAndNormalizePartitionIds(RequestPartitionId theRequestPartitionId) {
922-
return RequestPartitionId.defaultPartition();
996+
return RequestPartitionId.allPartitions();
923997
}
924998

925999
@Override
9261000
public RequestPartitionId validateAndNormalizePartitionNames(RequestPartitionId theRequestPartitionId) {
927-
return RequestPartitionId.defaultPartition();
1001+
return RequestPartitionId.allPartitions();
9281002
}
9291003

930-
9311004
}
9321005

9331006
private static class MockTransactionManager implements PlatformTransactionManager {

hapi-fhir-jpaserver-test-utilities/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
<artifactId>ojdbc11</artifactId>
146146
<version>21.5.0.0</version>
147147
</dependency>
148+
<dependency>
149+
<groupId>org.hibernate.orm</groupId>
150+
<artifactId>hibernate-community-dialects</artifactId>
151+
<version>${hibernate_version}</version>
152+
</dependency>
148153
<dependency>
149154
<groupId>org.testcontainers</groupId>
150155
<artifactId>testcontainers</artifactId>

hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/ResetSequencesTestHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public void afterEach(ExtensionContext theExtensionContext) throws Exception {
7777
*/
7878

7979
MappingMetamodelImpl metamodel = (MappingMetamodelImpl)entityManager.getMetamodel();
80-
81-
EntityPersister persister = metamodel.entityPersister(ResourceTable.class);
80+
EntityPersister persister = metamodel.findEntityDescriptor(ResourceTable.class);
8281

8382
List<Component.ValueGenerationPlan> generationPlans = getFieldValue(persister.getGenerator(), "generationPlans");
8483
Component.ValueGenerationPlan plan = generationPlans.get(0);

hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import ca.uhn.fhir.jpa.search.builder.predicate.ResourceTablePredicateBuilder;
1212
import ca.uhn.fhir.rest.api.SearchIncludeDeletedEnum;
1313
import com.google.common.collect.Lists;
14-
import org.hibernate.dialect.DerbyDialect;
15-
import org.hibernate.dialect.MySQL8Dialect;
14+
import org.hibernate.community.dialect.DerbyDialect;
15+
import org.hibernate.community.dialect.SQLServerLegacyDialect;
16+
import org.hibernate.dialect.MySQLDialect;
1617
import org.hibernate.dialect.PostgreSQLDialect;
17-
import org.hibernate.dialect.SQLServer2012Dialect;
1818
import org.hibernate.dialect.SQLServerDialect;
1919
import org.junit.jupiter.api.BeforeEach;
2020
import org.junit.jupiter.api.Test;
@@ -109,7 +109,7 @@ public void testRangeSqlServer2005_WithSort() {
109109
public void testRangeSqlServer2012_NoSort() {
110110

111111
HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider();
112-
dialectProvider.setDialectForUnitTest(new SQLServer2012Dialect());
112+
dialectProvider.setDialectForUnitTest(new SQLServerLegacyDialect());
113113
SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false, false);
114114
builder.addResourceIdsPredicate(Lists.newArrayList(JpaPid.fromId(500L), JpaPid.fromId(501L)));
115115
GeneratedSql generated;
@@ -135,7 +135,7 @@ public void testRangeSqlServer2012_NoSort() {
135135
public void testRangeSqlServer2012_WithSort() {
136136

137137
HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider();
138-
dialectProvider.setDialectForUnitTest(new SQLServer2012Dialect());
138+
dialectProvider.setDialectForUnitTest(new SQLServerLegacyDialect());
139139
SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false, false);
140140
builder.addResourceIdsPredicate(Lists.newArrayList(JpaPid.fromId(500L), JpaPid.fromId(501L)));
141141
builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true);
@@ -268,7 +268,7 @@ public void testRangeOracle12c_WithSort() {
268268
public void testRangeMySQL8_NoSort() {
269269

270270
HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider();
271-
dialectProvider.setDialectForUnitTest(new MySQL8Dialect());
271+
dialectProvider.setDialectForUnitTest(new MySQLDialect());
272272
SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false, false);
273273
builder.addResourceIdsPredicate(Lists.newArrayList(JpaPid.fromId(500L), JpaPid.fromId(501L)));
274274
GeneratedSql generated;
@@ -294,7 +294,7 @@ public void testRangeMySQL8_NoSort() {
294294
public void testRangeMySQL8_WithSort() {
295295

296296
HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider();
297-
dialectProvider.setDialectForUnitTest(new MySQL8Dialect());
297+
dialectProvider.setDialectForUnitTest(new MySQLDialect());
298298
SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false, false);
299299
builder.addResourceIdsPredicate(Lists.newArrayList(JpaPid.fromId(500L), JpaPid.fromId(501L)));
300300
builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true);

hapi-tinder-plugin/pom.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@
123123
<groupId>org.apache.velocity</groupId>
124124
<artifactId>velocity-engine-core</artifactId>
125125
</dependency>
126-
<dependency>
127-
<artifactId>commons-lang</artifactId>
128-
<groupId>commons-lang</groupId>
129-
<version>2.6</version>
130-
</dependency>
131126

132127
<dependency>
133128
<groupId>com.google.guava</groupId>
@@ -170,7 +165,8 @@
170165
<dependency>
171166
<groupId>org.apache.maven</groupId>
172167
<artifactId>maven-core</artifactId>
173-
<version>3.9.9</version>
168+
<version>3.9.11</version>
169+
<scope>provided</scope>
174170
</dependency>
175171
<dependency>
176172
<groupId>org.apache.maven</groupId>
@@ -187,7 +183,7 @@
187183
<dependency>
188184
<groupId>org.apache.ant</groupId>
189185
<artifactId>ant</artifactId>
190-
<version>1.10.11</version>
186+
<version>1.10.15</version>
191187
</dependency>
192188

193189
<!-- This is just used for -->
@@ -201,7 +197,7 @@
201197
<dependency>
202198
<groupId>commons-codec</groupId>
203199
<artifactId>commons-codec</artifactId>
204-
<version>1.15</version>
200+
<version>1.19.0</version>
205201
</dependency>
206202

207203
<!-- Hibernate deps -->
@@ -220,6 +216,7 @@
220216
<dependency>
221217
<groupId>com.h2database</groupId>
222218
<artifactId>h2</artifactId>
219+
<scope>test</scope>
223220
</dependency>
224221

225222
</dependencies>

0 commit comments

Comments
 (0)