HHH-12111 - Oracle does not support positive/negative initial sequence values for descending/ascending sequences unless MAXVALUE/MINVALUE is defined as well

This commit is contained in:
Vlad Mihalcea 2017-11-21 15:02:45 +02:00
parent 9b062e4a6b
commit 26041f49e1
1 changed files with 33 additions and 0 deletions

View File

@ -395,6 +395,39 @@ public class Oracle8iDialect extends Dialect {
return "create sequence " + sequenceName;
}
@Override
protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) {
if ( initialValue < 0 && incrementSize > 0 ) {
return
String.format(
"%s minvalue %d start with %d increment by %d",
getCreateSequenceString( sequenceName ),
initialValue,
initialValue,
incrementSize
);
}
else if ( initialValue > 0 && incrementSize < 0 ) {
return
String.format(
"%s maxvalue %d start with %d increment by %d",
getCreateSequenceString( sequenceName ),
initialValue,
initialValue,
incrementSize
);
}
else {
return
String.format(
"%s start with %d increment by %d",
getCreateSequenceString( sequenceName ),
initialValue,
incrementSize
);
}
}
@Override
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName;