diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java
index aa30500db527..5026aca0cbf1 100644
--- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java
+++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java
@@ -52,6 +52,15 @@
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
+import org.hibernate.type.BasicType;
+import org.hibernate.type.BasicTypeRegistry;
+import org.hibernate.type.StandardBasicTypes;
+import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.dialect.function.CurrentFunction;
+import org.hibernate.query.sqm.produce.function.StandardFunctionArgumentTypeResolvers;
+import jakarta.persistence.GenerationType;
+import java.util.Date;
+
import jakarta.persistence.TemporalType;
import static org.hibernate.dialect.SimpleDatabaseVersion.ZERO_VERSION;
@@ -59,14 +68,13 @@
import static org.hibernate.query.sqm.produce.function.FunctionParameterType.STRING;
/**
- * A SQL dialect for TimesTen 5.1.
+ * A SQL dialect for Oracle TimesTen
*
* Known limitations:
* joined-subclass support because of no CASE support in TimesTen
* No support for subqueries that includes aggregation
* - size() in HQL not supported
* - user queries that does subqueries with aggregation
- * No CLOB/BLOB support
* No cascade delete support.
* No Calendar support
* No support for updating primary keys.
@@ -83,6 +91,18 @@ public TimesTenDialect(DialectResolutionInfo info) {
super( info );
}
+ /*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - Added more datatypes into columnType():
+ * BIT, CHAR, VARCHAR, LONGVARCHAR, BINARY, VARBINARY
+ * LONGVARBINARY, BINARY_FLOAT, BINARY_DOUBLE, TIMESTAMP,
+ * BLOB, CLOB, NCLOB
+ *
+ * @Author: Carlos Blanco
+ */
@Override
protected String columnType(int sqlTypeCode) {
switch ( sqlTypeCode ) {
@@ -90,29 +110,56 @@ protected String columnType(int sqlTypeCode) {
// for the default Oracle type mode
// TypeMode=0
case SqlTypes.BOOLEAN:
+ case SqlTypes.BIT:
case SqlTypes.TINYINT:
- return "tt_tinyint";
+ return "TT_TINYINT";
case SqlTypes.SMALLINT:
- return "tt_smallint";
+ return "TT_SMALLINT";
case SqlTypes.INTEGER:
- return "tt_integer";
+ return "TT_INTEGER";
case SqlTypes.BIGINT:
- return "tt_bigint";
+ return "TT_BIGINT";
//note that 'binary_float'/'binary_double' might
//be better mappings for Java Float/Double
+ case SqlTypes.CHAR:
+ return "CHAR($l)";
+ case SqlTypes.VARCHAR:
+ case SqlTypes.LONGVARCHAR:
+ return "VARCHAR2($l)";
+
+ case SqlTypes.BINARY:
+ return "BINARY($l)";
+ case SqlTypes.VARBINARY:
+ case SqlTypes.LONGVARBINARY:
+ return "VARBINARY($l)";
+
//'numeric'/'decimal' are synonyms for 'number'
case SqlTypes.NUMERIC:
case SqlTypes.DECIMAL:
- return "number($p,$s)";
+ return "NUMBER($p,$s)";
+ case SqlTypes.FLOAT:
+ return "BINARY_FLOAT";
+ case SqlTypes.DOUBLE:
+ return "BINARY_DOUBLE";
+
case SqlTypes.DATE:
- return "tt_date";
+ return "TT_DATE";
case SqlTypes.TIME:
- return "tt_time";
+ return "TT_TIME";
+ case SqlTypes.TIMESTAMP:
+ return "TIMESTAMP";
//`timestamp` has more precision than `tt_timestamp`
case SqlTypes.TIMESTAMP_WITH_TIMEZONE:
return "timestamp($p)";
+ case SqlTypes.BLOB:
+ return "BLOB";
+ case SqlTypes.CLOB:
+ return "CLOB";
+ case SqlTypes.NCLOB:
+ return "NCLOB";
+
default:
return super.columnType( sqlTypeCode );
}
@@ -153,25 +200,235 @@ public int getDefaultDecimalPrecision() {
return 40;
}
+ /*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - Added more SQL functions support into initializeFunctionRegistry():
+ * lower, upper, rtrim, ltrim, length, to_char, chr, instr, instrb,
+ * lpad, rpad, substr, substrb, substring, str, soundex, replace,
+ * to_date, sysdate, getdate, current_date, current_time, current_timestamp,
+ * to_timestamp, add_months, months_between, abs, acos, asin, atan, atan2,
+ * ceil, cos, cosh, exp, ln, sin, sign, sinh, mod, round, trunc, tan, tanh,
+ * floor, power, bitnot, bitor, bitxor, nvl, user, rowid, uid, rownum,
+ * vsize, SESSION_USER, SYSTEM_USER, CURRENT_USER
+ *
+ * @Author: Carlos Blanco
+ */
@Override
public void initializeFunctionRegistry(FunctionContributions functionContributions) {
super.initializeFunctionRegistry(functionContributions);
- CommonFunctionFactory functionFactory = new CommonFunctionFactory(functionContributions);
- functionFactory.trim2();
- functionFactory.soundex();
- functionFactory.trunc();
- functionFactory.toCharNumberDateTimestamp();
- functionFactory.ceiling_ceil();
- functionFactory.instr();
- functionFactory.substr();
- functionFactory.substring_substr();
- functionFactory.leftRight_substr();
- functionFactory.char_chr();
- functionFactory.rownumRowid();
- functionFactory.sysdate();
- functionFactory.addMonths();
- functionFactory.monthsBetween();
+ final TypeConfiguration typeConfiguration = functionContributions.getTypeConfiguration();
+ CommonFunctionFactory functionFactory = new CommonFunctionFactory(functionContributions);
+ final BasicTypeRegistry basicTypeRegistry = typeConfiguration.getBasicTypeRegistry();
+ final BasicType timestampType = basicTypeRegistry.resolve( StandardBasicTypes.TIMESTAMP );
+ final BasicType dateType = basicTypeRegistry.resolve( StandardBasicTypes.DATE );
+ final BasicType timeType = basicTypeRegistry.resolve( StandardBasicTypes.TIME );
+ final BasicType stringType = basicTypeRegistry.resolve( StandardBasicTypes.STRING );
+ final BasicType longType = basicTypeRegistry.resolve( StandardBasicTypes.LONG );
+ final BasicTypeintType = basicTypeRegistry.resolve( StandardBasicTypes.INTEGER );
+
+ // String Functions
+ functionContributions.getFunctionRegistry().register(
+ "lower", new StandardSQLFunction("lower")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "upper", new StandardSQLFunction("upper")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "rtrim", new StandardSQLFunction("rtrim")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "ltrim", new StandardSQLFunction("ltrim")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "length", new StandardSQLFunction("length", StandardBasicTypes.LONG)
+ );
+ functionFactory.concat_pipeOperator();
+ functionContributions.getFunctionRegistry().register(
+ "to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "instr", new StandardSQLFunction("instr", StandardBasicTypes.INTEGER)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "instrb", new StandardSQLFunction("instrb", StandardBasicTypes.INTEGER)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "substrb", new StandardSQLFunction("substrb", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING )
+ );
+ functionFactory.locate();
+ functionContributions.getFunctionRegistry().register(
+ "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "soundex", new StandardSQLFunction("soundex")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING)
+ );
+
+ // Date/Time Functions
+ functionContributions.getFunctionRegistry().register(
+ "to_date", new StandardSQLFunction("to_date", StandardBasicTypes.TIMESTAMP)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "sysdate", new CurrentFunction("sysdate", "sysdate", timestampType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "getdate", new StandardSQLFunction("getdate", StandardBasicTypes.TIMESTAMP)
+ );
+
+ functionContributions.getFunctionRegistry().register(
+ "current_date", new CurrentFunction("sysdate", "sysdate", dateType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "current_time", new CurrentFunction("sysdate", "sysdate", timeType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "current_timestamp", new CurrentFunction("sysdate", "sysdate", timestampType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "to_timestamp", new StandardSQLFunction("to_timestamp", StandardBasicTypes.TIMESTAMP)
+ );
+
+ // Multi-param date dialect functions
+ functionContributions.getFunctionRegistry().register(
+ "add_months", new StandardSQLFunction("add_months", StandardBasicTypes.DATE)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "months_between", new StandardSQLFunction("months_between", StandardBasicTypes.FLOAT)
+ );
+
+ // Math functions
+ functionContributions.getFunctionRegistry().register(
+ "abs", new StandardSQLFunction("abs")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "acos", new StandardSQLFunction("acos")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "asin", new StandardSQLFunction("asin")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "atan", new StandardSQLFunction("atan")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "atan2", new StandardSQLFunction("atan2")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "ceil", new StandardSQLFunction("ceil")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "cos", new StandardSQLFunction("cos")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "cosh", new StandardSQLFunction("cosh")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "exp", new StandardSQLFunction("exp")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "ln", new StandardSQLFunction("ln")
+ );
+ functionFactory.log();
+ functionContributions.getFunctionRegistry().register(
+ "sin", new StandardSQLFunction("sin")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "sinh", new StandardSQLFunction("sinh")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "mod", new StandardSQLFunction("mod")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "round", new StandardSQLFunction("round")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "trunc", new StandardSQLFunction("trunc")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "tan", new StandardSQLFunction("tan")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "tanh", new StandardSQLFunction("tanh")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "floor", new StandardSQLFunction("floor")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT)
+ );
+
+ // Bitwise functions
+ functionFactory.bitand();
+ functionContributions.getFunctionRegistry().register(
+ "bitnot", new StandardSQLFunction("bitnot")
+ );
+
+ functionContributions.getFunctionRegistry()
+ .patternDescriptorBuilder( "bitor", "(?1+?2-bitand(?1,?2))")
+ .setExactArgumentCount( 2 )
+ .setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers
+ .ARGUMENT_OR_IMPLIED_RESULT_TYPE )
+ .register();
+
+ functionContributions.getFunctionRegistry()
+ .patternDescriptorBuilder( "bitxor", "(?1+?2-2*bitand(?1,?2))")
+ .setExactArgumentCount( 2 )
+ .setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers
+ .ARGUMENT_OR_IMPLIED_RESULT_TYPE )
+ .register();
+
+ // Misc. functions
+ functionContributions.getFunctionRegistry().register(
+ "nvl", new StandardSQLFunction("nvl")
+ );
+ functionFactory.coalesce();
+ functionContributions.getFunctionRegistry().register(
+ "user", new CurrentFunction("user", "user", stringType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "rowid", new CurrentFunction("rowid", "rowid", stringType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "uid", new CurrentFunction("uid", "uid", intType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "rownum", new CurrentFunction("rownum", "rownum", longType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "vsize", new StandardSQLFunction("vsize")
+ );
+ functionContributions.getFunctionRegistry().register(
+ "SESSION_USER", new CurrentFunction("SESSION_USER","SESSION_USER", stringType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "SYSTEM_USER", new CurrentFunction("SYSTEM_USER", "SYSTEM_USER", stringType)
+ );
+ functionContributions.getFunctionRegistry().register(
+ "CURRENT_USER", new CurrentFunction("CURRENT_USER","CURRENT_USER", stringType)
+ );
functionContributions.getFunctionRegistry().registerBinaryTernaryPattern(
"locate",
@@ -251,9 +508,19 @@ public RowLockStrategy getWriteRowLockStrategy() {
return RowLockStrategy.COLUMN;
}
+
+ /*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - Updated the custom definition for 'getForUpdateString()'
+ *
+ * @Author: Carlos Blanco
+ */
@Override
- public String getForUpdateString(String aliases) {
- return " for update of " + aliases;
+ public String getForUpdateString() {
+ return " for update";
}
@Override
@@ -426,4 +693,67 @@ public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfi
}
}
+ /*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - Added a custom definition for 'getNativeIdentifierGeneratorStrategy()'
+ * - Added a custom definition for 'currentDate()'
+ * - Added a custom definition for 'currentTime()'
+ * - Added a custom definition for 'getMaxVarcharLength()'
+ * - Added a custom definition for 'getMaxVarbinaryLength()'
+ * - Added a custom definition for 'isEmptyStringTreatedAsNull()'
+ * - Added a custom definition for 'supportsTupleDistinctCounts()'
+ * - Added a custom definition for 'getDual()'
+ * - Added a custom definition for 'getFromDualForSelectOnly()'
+ *
+ * @Author: Carlos Blanco
+ */
+
+ @Override
+ public String getNativeIdentifierGeneratorStrategy() {
+ return "sequence";
+ }
+
+ @Override
+ public String currentDate() {
+ return "sysdate";
+ }
+
+ @Override
+ public String currentTime() {
+ return "sysdate";
+ }
+
+ @Override
+ public int getMaxVarcharLength() {
+ // 1 to 4,194,304 bytes according to TimesTen Doc
+ return 4194304;
+ }
+
+ @Override
+ public int getMaxVarbinaryLength() {
+ // 1 to 4,194,304 bytes according to TimesTen Doc
+ return 4194304;
+ }
+
+ @Override
+ public boolean isEmptyStringTreatedAsNull() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsTupleDistinctCounts() {
+ return false;
+ }
+
+ public String getDual() {
+ return "dual";
+ }
+
+ public String getFromDualForSelectOnly() {
+ return " from dual";
+ }
+
}
diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenSqlAstTranslator.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenSqlAstTranslator.java
index b0eadebbfa06..cffeeec27a2e 100644
--- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenSqlAstTranslator.java
+++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenSqlAstTranslator.java
@@ -28,6 +28,8 @@
import org.hibernate.sql.ast.tree.select.QuerySpec;
import org.hibernate.sql.ast.tree.select.SelectClause;
import org.hibernate.sql.exec.spi.JdbcOperation;
+import org.hibernate.internal.util.collections.Stack;
+import org.hibernate.sql.ast.Clause;
/**
* A SQL AST translator for TimesTen.
@@ -143,4 +145,65 @@ protected boolean supportsRowValueConstructorSyntaxInInList() {
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
return false;
}
+
+ /*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - Added a custom definition for 'renderRowsToClause()'.
+ *
+ * @Author: Carlos Blanco
+ */
+ @Override
+ protected void renderRowsToClause(Expression offsetClauseExpression, Expression fetchClauseExpression) {
+ // offsetClauseExpression -> firstRow
+ // fetchClauseExpression -> maxRows
+ final Stack clauseStack = getClauseStack();
+
+ if ( offsetClauseExpression == null && fetchClauseExpression != null ) {
+ // We only have a maxRows/limit. We use 'SELECT FIRST n' syntax
+ appendSql("first ");
+ clauseStack.push( Clause.FETCH );
+ try {
+ renderFetchExpression( fetchClauseExpression );
+ }
+ finally {
+ clauseStack.pop();
+ }
+ }
+ else if ( offsetClauseExpression != null && fetchClauseExpression == null ) {
+ throw new UnsupportedOperationException(
+ "Only passing setFirstResult(m) and not setMaxResults(n) to 'ROWS m TO n' clause not supported."
+ );
+ }
+ else if ( offsetClauseExpression != null && fetchClauseExpression != null ) {
+ // We have offset and maxRows/limit. We use 'SELECT ROWS offset TO limit' syntax
+ appendSql( "rows " );
+
+ // Render offset parameter
+ clauseStack.push( Clause.OFFSET );
+ try {
+ renderOffsetExpression( offsetClauseExpression );
+ }
+ finally {
+ clauseStack.pop();
+ }
+
+ appendSql( " to " );
+
+ // Render maxRows/limit parameter
+ clauseStack.push( Clause.FETCH );
+ try {
+ // TimesTen includes both m and n rows of 'ROWS m to n';
+ // We need to substract 1 row to fit maxRows
+ renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 );
+ }
+ finally {
+ clauseStack.pop();
+ }
+ }
+
+ appendSql( WHITESPACE );
+ }
}
diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/pagination/TimesTenLimitHandler.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/pagination/TimesTenLimitHandler.java
index 4d95ef2af0df..225aa733b45b 100644
--- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/pagination/TimesTenLimitHandler.java
+++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/pagination/TimesTenLimitHandler.java
@@ -7,22 +7,79 @@
package org.hibernate.community.dialect.pagination;
import org.hibernate.dialect.pagination.LimitHandler;
+import org.hibernate.dialect.pagination.LimitHandler;
+import org.hibernate.dialect.pagination.AbstractLimitHandler;
/**
* A {@link LimitHandler} for TimesTen, which uses {@code ROWS n},
* but at the start of the query instead of at the end.
*/
-public class TimesTenLimitHandler extends RowsLimitHandler {
+
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - The class now extends 'AbstractLimitHandler'
+ * - Removed a custom definition for 'insert()'
+ * - Added a custom definition for 'supportsLimit()'
+ * - Added a custom definition for 'supportsOffset()'
+ * - Added a custom definition for 'supportsLimitOffset()'
+ * - Added a custom definition for 'supportsVariableLimit()'
+ * - Added a custom definition for 'convertToFirstRowValue(int zeroBasedFirstResult)'
+ * - Added a custom definition for 'useMaxForLimit()'
+ * - Added a custom definition for 'limitClause(boolean hasFirstRow)'
+ *
+ * @Author: Carlos Blanco
+ *
+*/
+public class TimesTenLimitHandler extends AbstractLimitHandler {
public static final TimesTenLimitHandler INSTANCE = new TimesTenLimitHandler();
+ public TimesTenLimitHandler(){
+ }
+
+ @Override
+ public boolean supportsLimit() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsOffset() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsLimitOffset() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsVariableLimit() {
+ // a limit string using literals instead of parameters is
+ // required to translate from Hibernate's 0 based row numbers
+ // to TimesTen 1 based row numbers
+ return false;
+ }
+
@Override
- protected String insert(String rows, String sql) {
- return insertAfterSelect( rows, sql );
+ // TimesTen is 1 based
+ public int convertToFirstRowValue(int zeroBasedFirstResult) {
+ return zeroBasedFirstResult + 1;
+ }
+
+ @Override
+ public boolean useMaxForLimit() {
+ return true;
}
@Override
public boolean bindLimitParametersFirst() {
return true;
}
+
+ protected String limitClause(boolean hasFirstRow) {
+ return hasFirstRow ? " rows ? to ?" : " first ?";
+ }
}
diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/sequence/TimesTenSequenceSupport.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/sequence/TimesTenSequenceSupport.java
index 802aa1b5801d..bc9e8c279f7c 100644
--- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/sequence/TimesTenSequenceSupport.java
+++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/sequence/TimesTenSequenceSupport.java
@@ -6,7 +6,6 @@
*/
package org.hibernate.community.dialect.sequence;
-import org.hibernate.dialect.sequence.NextvalSequenceSupport;
import org.hibernate.dialect.sequence.SequenceSupport;
/**
@@ -14,13 +13,61 @@
*
* @author Gavin King
*/
-public final class TimesTenSequenceSupport extends NextvalSequenceSupport {
+
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ * Licensed under the Universal Permissive License v 1.0 as shown
+ * at http://oss.oracle.com/licenses/upl
+ *
+ * - The Class now implements 'SequenceSupport'
+ * - Added a custom definition for 'supportsSequences()'
+ * - Added a custom definition for 'supportsPooledSequences()'
+ * - Added a custom definition for 'getSelectSequenceNextValString(String sequenceName)'
+ * - Added a custom definition for 'getSequenceNextValString(String sequenceName)'
+ * - Added a custom definition for 'getCreateSequenceString(String sequenceName)'
+ * - Added a custom definition for 'getDropSequenceString(String sequenceName)'
+ *
+ * @Author: Carlos Blanco
+ *
+*/
+public final class TimesTenSequenceSupport implements SequenceSupport {
public static final SequenceSupport INSTANCE = new TimesTenSequenceSupport();
+
+
+ @Override
+ public boolean supportsSequences() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsPooledSequences() {
+ return true;
+ }
+
+ @Override
+ public String getSelectSequenceNextValString(String sequenceName) {
+ return sequenceName + ".nextval";
+ }
+
+ @Override
+ public String getSequenceNextValString(String sequenceName) {
+ return "select " + sequenceName + ".nextval from sys.dual";
+ }
+
@Override
public String getFromDual() {
return " from sys.dual";
}
+ @Override
+ public String getCreateSequenceString(String sequenceName) {
+ return "create sequence " + sequenceName;
+ }
+
+ @Override
+ public String getDropSequenceString(String sequenceName) {
+ return "drop sequence " + sequenceName;
+ }
}