HHH-18142 Add Oracle Database 23ai support for DROP SEQUENCE IF EXISTS
This commit is contained in:
parent
31e3be15bf
commit
fcc33f3fe1
|
@ -993,7 +993,7 @@ public class OracleLegacyDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public SequenceSupport getSequenceSupport() {
|
||||
return OracleSequenceSupport.INSTANCE;
|
||||
return OracleSequenceSupport.getInstance(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1048,7 +1048,7 @@ public class OracleDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public SequenceSupport getSequenceSupport() {
|
||||
return OracleSequenceSupport.INSTANCE;
|
||||
return OracleSequenceSupport.getInstance(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,22 +6,46 @@
|
|||
*/
|
||||
package org.hibernate.dialect.sequence;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
||||
/**
|
||||
* Sequence support for {@link org.hibernate.dialect.OracleDialect}.
|
||||
*
|
||||
* @author Gavin King
|
||||
* @author Loïc Lefèvre
|
||||
*
|
||||
* @see <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CREATE-SEQUENCE.html">Oracle Database Documentation</a>
|
||||
*/
|
||||
public final class OracleSequenceSupport extends NextvalSequenceSupport {
|
||||
|
||||
public static final SequenceSupport INSTANCE = new OracleSequenceSupport();
|
||||
public static SequenceSupport getInstance(final Dialect dialect) {
|
||||
return new OracleSequenceSupport(dialect);
|
||||
}
|
||||
|
||||
private final boolean requiresFromDUAL;
|
||||
private final boolean supportsIfExists;
|
||||
|
||||
// TODO: HHH-18144 - Support Oracle sequence optional KEEP for Application Continuity
|
||||
// TODO: HHH-18143 - Support Oracle scalable sequences for RAC
|
||||
|
||||
public OracleSequenceSupport(final Dialect dialect) {
|
||||
requiresFromDUAL = dialect.getVersion().isBefore(23);
|
||||
supportsIfExists = dialect.getVersion().isSameOrAfter(23);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFromDual() {
|
||||
return " from dual";
|
||||
return requiresFromDUAL ? " from dual" : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sometimesNeedsStartingValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDropSequenceString(String sequenceName) throws MappingException {
|
||||
return "drop sequence " + (supportsIfExists ? "if exists " : "") + sequenceName;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue