Skip to content

Commit 4428e1a

Browse files
committed
HHH-10110 - Fix DerbyDialect#getQuerySequencesString() causing error during schema update
1 parent f7d9640 commit 4428e1a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ public boolean supportsSequences() {
123123
return driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 );
124124
}
125125

126+
@Override
127+
public String getQuerySequencesString() {
128+
if ( supportsSequences() ) {
129+
return "select SEQUENCENAME from SYS.SYSSEQUENCES";
130+
}
131+
else {
132+
throw new MappingException( "Derby does not support sequence prior to release 10.6.1.0" );
133+
}
134+
}
135+
126136
@Override
127137
public String getSequenceNextValString(String sequenceName) {
128138
if ( supportsSequences() ) {
@@ -235,7 +245,7 @@ private boolean hasForUpdateClause(int forUpdateIndex) {
235245
}
236246

237247
private boolean hasWithClause(String normalizedSelect){
238-
return normalizedSelect.startsWith( "with ", normalizedSelect.length()-7 );
248+
return normalizedSelect.startsWith( "with ", normalizedSelect.length() - 7 );
239249
}
240250

241251
private int getWithIndex(String querySelect) {
@@ -246,11 +256,6 @@ private int getWithIndex(String querySelect) {
246256
return i;
247257
}
248258

249-
@Override
250-
public String getQuerySequencesString() {
251-
return null ;
252-
}
253-
254259

255260
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
256261

0 commit comments

Comments
 (0)