Skip to content

Commit 15bd025

Browse files
christophstroblmp911de
authored andcommitted
Upgrade to Hibernate 7.0.0.CR1.
Closes: #3872
1 parent f670430 commit 15bd025

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<antlr>4.13.2</antlr> <!-- align with Hibernate's parser -->
3131
<eclipselink>5.0.0-B07</eclipselink>
3232
<eclipselink-next>5.0.0-SNAPSHOT</eclipselink-next>
33-
<hibernate>7.0.0.Beta5</hibernate>
33+
<hibernate>7.0.0.CR1</hibernate>
3434
<hibernate-70-snapshots>7.0.0-SNAPSHOT</hibernate-70-snapshots>
3535
<hsqldb>2.7.4</hsqldb>
3636
<h2>2.3.232</h2>

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlOrderExpressionVisitorUnitTests.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package org.springframework.data.jpa.repository.query;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20+
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
21+
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
1922

2023
import jakarta.persistence.EntityManager;
2124
import jakarta.persistence.PersistenceContext;
@@ -27,11 +30,11 @@
2730

2831
import java.util.Locale;
2932

33+
import org.hibernate.query.sqm.tree.SqmRenderContext;
3034
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
3135
import org.junit.jupiter.api.Disabled;
3236
import org.junit.jupiter.api.Test;
3337
import org.junit.jupiter.api.extension.ExtendWith;
34-
3538
import org.springframework.data.jpa.domain.JpaSort;
3639
import org.springframework.data.jpa.domain.sample.User;
3740
import org.springframework.test.context.ContextConfiguration;
@@ -125,26 +128,26 @@ void temporalLiterals() {
125128

126129
// JDBC
127130
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {ts '2024-01-01 12:34:56'}"), "u"))
128-
.startsWithIgnoringCase("order by u.createdAt + 2024-01-01T12:34:56");
131+
.startsWithIgnoringCase("order by u.createdAt + '2024-01-01T12:34:56'");
129132

130133
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {ts '2012-01-03 09:00:00.000000001'}"), "u"))
131-
.startsWithIgnoringCase("order by u.createdAt + 2012-01-03T09:00:00.000000001");
134+
.startsWithIgnoringCase("order by u.createdAt + '2012-01-03T09:00:00.000000001'");
132135

133136
// Hibernate NPE
134-
assertThatNullPointerException().isThrownBy(() -> renderOrderBy(JpaSort.unsafe("createdAt + {t '12:34:56'}"), "u"));
137+
assertThatIllegalArgumentException().isThrownBy(() -> renderOrderBy(JpaSort.unsafe("createdAt + {t '12:34:56'}"), "u"));
135138

136139
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {d '2024-01-01'}"), "u"))
137-
.startsWithIgnoringCase("order by u.createdAt + 2024-01-01");
140+
.startsWithIgnoringCase("order by u.createdAt + '2024-01-01'");
138141

139142
// JPQL
140143
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {ts 2024-01-01 12:34:56}"), "u"))
141-
.startsWithIgnoringCase("order by u.createdAt + 2024-01-01T12:34:56");
144+
.startsWithIgnoringCase("order by u.createdAt + '2024-01-01T12:34:56'");
142145

143146
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {t 12:34:56}"), "u"))
144-
.startsWithIgnoringCase("order by u.createdAt + 12:34:56");
147+
.startsWithIgnoringCase("order by u.createdAt + '12:34:56'");
145148

146149
assertThat(renderOrderBy(JpaSort.unsafe("createdAt + {d 2024-01-01}"), "u"))
147-
.startsWithIgnoringCase("order by u.createdAt + 2024-01-01");
150+
.startsWithIgnoringCase("order by u.createdAt + '2024-01-01'");
148151
}
149152

150153
@Test // GH-3172
@@ -262,7 +265,7 @@ String renderQuery(JpaSort sort, String alias) {
262265
SqmSelectStatement s = (SqmSelectStatement) q;
263266

264267
StringBuilder builder = new StringBuilder();
265-
s.appendHqlString(builder);
268+
s.appendHqlString(builder, SqmRenderContext.simpleContext());
266269

267270
return builder.toString();
268271
}

0 commit comments

Comments
 (0)