Skip to content

Commit 5a69b6b

Browse files
committed
Upgrade Hibernate to version 6.1.1.Final
1 parent b89ea8e commit 5a69b6b

File tree

5 files changed

+12
-30
lines changed

5 files changed

+12
-30
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<spring-ldap.version>3.0.0-SNAPSHOT</spring-ldap.version>
6969
<avro.version>1.9.2</avro.version>
7070
<gson.version>2.9.0</gson.version>
71-
<hibernate-core-jakarta.version>5.6.9.Final</hibernate-core-jakarta.version>
71+
<hibernate-core.version>6.1.1.Final</hibernate-core.version>
7272
<jakarta.annotation-api.version>2.0.0</jakarta.annotation-api.version>
7373
<jakarta.mail-api.version>2.0.1</jakarta.mail-api.version>
7474
<jakarta.jms-api.version>3.0.0</jakarta.jms-api.version>

spring-batch-infrastructure/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@
9696
<optional>true</optional>
9797
</dependency>
9898
<dependency>
99-
<groupId>org.hibernate</groupId>
100-
<artifactId>hibernate-core-jakarta</artifactId>
101-
<version>${hibernate-core-jakarta.version}</version>
99+
<groupId>org.hibernate.orm</groupId>
100+
<artifactId>hibernate-core</artifactId>
101+
<version>${hibernate-core.version}</version>
102102
<optional>true</optional>
103103
</dependency>
104104
<dependency>

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateCursorItemReader.java

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2019 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -52,6 +52,7 @@
5252
*
5353
* @author Robert Kasanicky
5454
* @author Dave Syer
55+
* @author Mahmoud Ben Hassine
5556
*/
5657
public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStreamItemReader<T>
5758
implements InitializingBean {
@@ -62,7 +63,7 @@ public HibernateCursorItemReader() {
6263
setName(ClassUtils.getShortName(HibernateCursorItemReader.class));
6364
}
6465

65-
private ScrollableResults cursor;
66+
private ScrollableResults<? extends T> cursor;
6667

6768
private boolean initialized = false;
6869

@@ -143,25 +144,7 @@ public void setUseStatelessSession(boolean useStatelessSession) {
143144
@Override
144145
protected T doRead() throws Exception {
145146
if (cursor.next()) {
146-
Object[] data = cursor.get();
147-
148-
if (data.length > 1) {
149-
// If there are multiple items this must be a projection
150-
// and T is an array type.
151-
@SuppressWarnings("unchecked")
152-
T item = (T) data;
153-
return item;
154-
}
155-
else {
156-
// Assume if there is only one item that it is the data the user
157-
// wants.
158-
// If there is only one item this is going to be a nasty shock
159-
// if T is an array type but there's not much else we can do...
160-
@SuppressWarnings("unchecked")
161-
T item = (T) data[0];
162-
return item;
163-
}
164-
147+
return cursor.get();
165148
}
166149
return null;
167150
}

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void afterPropertiesSet() throws Exception {
111111
* @param parameterValues the parameter values to use (or null if none).
112112
* @return a forward-only {@link ScrollableResults}
113113
*/
114-
public ScrollableResults getForwardOnlyCursor(int fetchSize, Map<String, Object> parameterValues) {
114+
public ScrollableResults<? extends T> getForwardOnlyCursor(int fetchSize, Map<String, Object> parameterValues) {
115115
Query<? extends T> query = createQuery();
116116
if (!CollectionUtils.isEmpty(parameterValues)) {
117117
query.setProperties(parameterValues);
@@ -123,7 +123,6 @@ public ScrollableResults getForwardOnlyCursor(int fetchSize, Map<String, Object>
123123
* Open appropriate type of hibernate session and create the query.
124124
* @return a Hibernate Query
125125
*/
126-
@SuppressWarnings("unchecked") // Hibernate APIs do not use a typed Query
127126
public Query<? extends T> createQuery() {
128127

129128
if (useStatelessSession) {

spring-batch-samples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
<version>${aspectj.version}</version>
7373
</dependency>
7474
<dependency>
75-
<groupId>org.hibernate</groupId>
76-
<artifactId>hibernate-core-jakarta</artifactId>
77-
<version>${hibernate-core-jakarta.version}</version>
75+
<groupId>org.hibernate.orm</groupId>
76+
<artifactId>hibernate-core</artifactId>
77+
<version>${hibernate-core.version}</version>
7878
</dependency>
7979
<dependency>
8080
<groupId>org.apache.commons</groupId>

0 commit comments

Comments
 (0)