Skip to content

Commit 795e1da

Browse files
committed
fix for H2 2.x
1 parent a182cfa commit 795e1da

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
<dependency>
210210
<groupId>org.springframework</groupId>
211211
<artifactId>spring-framework-bom</artifactId>
212-
<version>5.3.18</version>
212+
<version>5.3.19</version>
213213
<type>pom</type>
214214
<scope>import</scope>
215215
</dependency>
@@ -281,7 +281,7 @@
281281
<dependency>
282282
<groupId>com.h2database</groupId>
283283
<artifactId>h2</artifactId>
284-
<version>1.4.200</version>
284+
<version>2.1.212</version>
285285
<scope>test</scope>
286286
</dependency>
287287
<dependency>

src/main/java/com/github/marschall/hibernate/batchsequencegenerator/BatchSequenceGenerator.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@
5353
* <h2>SQL</h2>
5454
* Per default the generated SELECT will look something like this
5555
* <pre><code>
56-
* WITH RECURSIVE t(n, level_num) AS (
57-
* SELECT nextval(seq_xxx) as n, 1 as level_num
56+
* WITH RECURSIVE t(n) AS (
57+
* SELECT 1
5858
* UNION ALL
59-
* SELECT nextval(seq_xxx) as n, level_num + 1 as level_num
59+
* SELECT n + 1
6060
* FROM t
61-
* WHERE level_num &lt; ?)
62-
* SELECT n
61+
* WHERE n &lt; ?)
62+
* SELECT nextval(seq_xxx)
6363
* FROM t;
6464
* </code></pre>
6565
*
@@ -218,13 +218,13 @@ private static String buildSelect(String sequenceName, Dialect dialect) {
218218
+ " WHERE level_num < ?) "
219219
+ "SELECT n FROM t";
220220
}
221-
return "WITH RECURSIVE t(n, level_num) AS ("
222-
+ "SELECT " + dialect.getSequenceSupport().getSelectSequenceNextValString(sequenceName) + " as n, 1 as level_num "
221+
return "WITH RECURSIVE t(n) AS ("
222+
+ "SELECT 1 "
223223
+ "UNION ALL "
224-
+ "SELECT " + dialect.getSequenceSupport().getSelectSequenceNextValString(sequenceName) + " as n, level_num + 1 as level_num "
224+
+ "SELECT n + 1 "
225225
+ " FROM t "
226-
+ " WHERE level_num < ?) "
227-
+ "SELECT n FROM t";
226+
+ " WHERE n < ?) "
227+
+ "SELECT " + dialect.getSequenceSupport().getSelectSequenceNextValString(sequenceName) + " FROM t";
228228
}
229229

230230
private SequenceStructure buildDatabaseStructure(Type type, String sequenceName, JdbcEnvironment jdbcEnvironment, Properties params) {

0 commit comments

Comments
 (0)