HHH-15013 H2 2.0.202 no longer supports nextval, replacing with ANSI SQL
This commit is contained in:
parent
30f627ce39
commit
bcb1577b43
|
@ -19,7 +19,8 @@ import org.hibernate.dialect.identity.IdentityColumnSupport;
|
|||
import org.hibernate.dialect.pagination.LimitHandler;
|
||||
import org.hibernate.dialect.pagination.LimitOffsetLimitHandler;
|
||||
import org.hibernate.dialect.pagination.OffsetFetchLimitHandler;
|
||||
import org.hibernate.dialect.sequence.H2SequenceSupport;
|
||||
import org.hibernate.dialect.sequence.H2V1SequenceSupport;
|
||||
import org.hibernate.dialect.sequence.H2V2SequenceSupport;
|
||||
import org.hibernate.dialect.sequence.SequenceSupport;
|
||||
import org.hibernate.dialect.temptable.TemporaryTable;
|
||||
import org.hibernate.dialect.temptable.TemporaryTableKind;
|
||||
|
@ -76,6 +77,7 @@ public class H2Dialect extends Dialect {
|
|||
|
||||
private final LimitHandler limitHandler;
|
||||
|
||||
private final boolean ansiSequence;
|
||||
private final boolean cascadeConstraints;
|
||||
private final boolean useLocalTime;
|
||||
|
||||
|
@ -105,6 +107,11 @@ public class H2Dialect extends Dialect {
|
|||
}
|
||||
|
||||
supportsTuplesInSubqueries = version.isSameOrAfter( 1, 4, 198 );
|
||||
|
||||
// Prior to 1.4.200 there was no support for 'current value for sequence_name'
|
||||
// After 2.0.202 there is no support for 'sequence_name.nextval' and 'sequence_name.currval'
|
||||
ansiSequence = version.isSameOrAfter( 1, 4, 200 );
|
||||
|
||||
// Prior to 1.4.200 the 'cascade' in 'drop table' was implicit
|
||||
cascadeConstraints = version.isSameOrAfter( 1, 4, 200 );
|
||||
// 1.4.200 introduced changes in current_time and current_timestamp
|
||||
|
@ -379,7 +386,7 @@ public class H2Dialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public SequenceSupport getSequenceSupport() {
|
||||
return H2SequenceSupport.INSTANCE;
|
||||
return ansiSequence ? H2V2SequenceSupport.INSTANCE: H2V1SequenceSupport.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,9 +13,9 @@ import org.hibernate.MappingException;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public final class H2SequenceSupport implements SequenceSupport {
|
||||
public final class H2V1SequenceSupport implements SequenceSupport {
|
||||
|
||||
public static final SequenceSupport INSTANCE = new H2SequenceSupport();
|
||||
public static final SequenceSupport INSTANCE = new H2V1SequenceSupport();
|
||||
|
||||
@Override
|
||||
public String getDropSequenceString(String sequenceName) {
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.dialect.sequence;
|
||||
|
||||
/**
|
||||
* Sequence support for {@link org.hibernate.dialect.H2Dialect}.
|
||||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public final class H2V2SequenceSupport extends ANSISequenceSupport {
|
||||
|
||||
public static final SequenceSupport INSTANCE = new H2V2SequenceSupport();
|
||||
|
||||
@Override
|
||||
public String getDropSequenceString(String sequenceName) {
|
||||
return "drop sequence if exists " + sequenceName;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue