Skip to content

Commit 7169215

Browse files
committed
Upgrade to Hibernate 6.3.1; Cleanup in JPA module
1 parent ea3e118 commit 7169215

File tree

5 files changed

+14
-27
lines changed

5 files changed

+14
-27
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ext {
7070
groovyVersion = '4.0.15'
7171
hamcrestVersion = '2.2'
7272
hazelcastVersion = '5.3.2'
73-
hibernateVersion = '6.2.8.Final'
73+
hibernateVersion = '6.3.1.Final'
7474
hsqldbVersion = '2.7.2'
7575
h2Version = '2.2.224'
7676
jacksonVersion = '2.15.2'

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -314,7 +314,6 @@ private void setParametersIfRequired(String queryString, @Nullable ParameterSour
314314
final Object paramValue;
315315

316316
if (position != null) {
317-
318317
if (source instanceof PositionSupportingParameterSource) {
319318
paramValue = ((PositionSupportingParameterSource) source).getValueByPosition(position);
320319
query.setParameter(position, paramValue);
@@ -323,10 +322,8 @@ private void setParametersIfRequired(String queryString, @Nullable ParameterSour
323322
throw new JpaOperationFailedException("Positional Parameters are only support "
324323
+ "for PositionSupportingParameterSources.", queryString);
325324
}
326-
327325
}
328326
else {
329-
330327
if (StringUtils.hasText(paramName)) {
331328
paramValue = source.getValue(paramName);
332329
query.setParameter(paramName, paramValue);
@@ -337,13 +334,11 @@ private void setParametersIfRequired(String queryString, @Nullable ParameterSour
337334
"Additionally it is not a positional parameter, neither.", queryString);
338335
}
339336
}
340-
341337
}
342338
}
343339
else {
344340
throw new IllegalArgumentException("Query has parameters but no parameter source provided");
345341
}
346-
347342
}
348343
}
349344

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -300,7 +300,6 @@ public void setParameterSource(ParameterSource parameterSource) {
300300
}
301301

302302
/**
303-
*
304303
* This parameter indicates that only one result object shall be returned as
305304
* a result from the executed JPA operation. If set to <code>true</code> and
306305
* the result list from the JPA operations contains only 1 element, then that
@@ -373,7 +372,6 @@ public void afterPropertiesSet() {
373372
new ExpressionEvaluatingParameterSourceFactory(this.beanFactory);
374373
expressionSourceFactory.setParameters(this.jpaParameters);
375374
this.parameterSourceFactory = expressionSourceFactory;
376-
377375
}
378376
else {
379377
throw new IllegalStateException("The 'jpaParameters' and 'parameterSourceFactory' " +
@@ -384,14 +382,11 @@ public void afterPropertiesSet() {
384382
if (this.usePayloadAsParameterSource == null) {
385383
this.usePayloadAsParameterSource = false;
386384
}
387-
388385
}
389386
else {
390-
391387
if (this.parameterSourceFactory == null) {
392388
this.parameterSourceFactory = new BeanPropertyParameterSourceFactory();
393389
}
394-
395390
if (this.usePayloadAsParameterSource == null) {
396391
this.usePayloadAsParameterSource = true;
397392
}
@@ -441,12 +436,14 @@ else if (this.namedQuery != null) {
441436
private Object executeOutboundJpaOperationOnPersistentMode(Message<?> message) {
442437
Object payload = message.getPayload();
443438
switch (this.persistMode) {
444-
case PERSIST:
439+
case PERSIST -> {
445440
this.jpaOperations.persist(payload, this.flushSize, this.clearOnFlush);
446441
return payload;
447-
case MERGE:
442+
}
443+
case MERGE -> {
448444
return this.jpaOperations.merge(payload, this.flushSize, this.clearOnFlush); // NOSONAR
449-
case DELETE:
445+
}
446+
case DELETE -> {
450447
if (payload instanceof Iterable) {
451448
this.jpaOperations.deleteInBatch((Iterable<?>) payload);
452449
}
@@ -457,8 +454,8 @@ private Object executeOutboundJpaOperationOnPersistentMode(Message<?> message) {
457454
this.jpaOperations.flush();
458455
}
459456
return payload;
460-
default:
461-
throw new IllegalStateException("Unsupported PersistMode: " + this.persistMode.name());
457+
}
458+
default -> throw new IllegalStateException("Unsupported PersistMode: " + this.persistMode.name());
462459
}
463460
}
464461

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGateway.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
3333
* Depending on the selected {@link OutboundGatewayType}, the outbound gateway
3434
* will use either the {@link JpaExecutor}'s poll method or its
3535
* executeOutboundJpaOperation method.
36-
*
36+
* <p>
3737
* In order to initialize the adapter, you must provide a {@link JpaExecutor} as
3838
* constructor.
3939
*
@@ -65,12 +65,7 @@ public JpaOutboundGateway(JpaExecutor jpaExecutor) {
6565

6666
@Override
6767
public String getComponentType() {
68-
return "jpa:outbound-gateway";
69-
}
70-
71-
@Override
72-
protected void doInit() {
73-
this.jpaExecutor.setBeanFactory(this.getBeanFactory());
68+
return "jpa:outbound-" + (this.producesReply ? "gateway" : "channel-adapter");
7469
}
7570

7671
@Override

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void setProducesReply(boolean producesReply) {
6262
}
6363

6464
/**
65-
* Specifies the time the gateway will wait to send the result to the reply channel.
65+
* Specify the time the gateway will wait to send the result to the reply channel.
6666
* Only applies when the reply channel itself might block the 'send' operation
6767
* (for example a bounded QueueChannel that is currently full).
6868
* @param replyTimeout The timeout in milliseconds

0 commit comments

Comments
 (0)