Skip to content

Oracle TimesTen Dialect for Hibernate 6.6 Updates #10492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: 6.6
Choose a base branch
from

Conversation

carlblan
Copy link

@carlblan carlblan commented Jul 8, 2025

Some updates from an Oracle employee to the Oracle TimesTen Community dialect. ( Hibernate 6.6 )

In TimesTenDialect.java

Adding more datatypes into columnType()
Added more SQL functions support into initializeFunctionRegistry()
Updated the custom definition for 'getForUpdateString()'
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()'

In TimesTenSqlAstTranslator.java

Added a custom definition for 'renderRowsToClause()'

In TimesTenLimitHandler.java

    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)'

In TimesTenSequenceSupport.java

    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)'

Testing:

The changes were tested with some local tests we have using this Hibernate 6 TimesTen community dialect.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Jul 8, 2025

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [2c9106b, 1774784, 24943b1, a4befa5, 8dcb063, 0fa1674, 9380dbd, 4cc3ccf]

› This message was automatically generated.

@carlblan
Copy link
Author

carlblan commented Jul 8, 2025

@beikov @mbellade @yrodiere

Here's a new PR to update the TimesTen Community Dialect for Hibernate 6.6

I closed the previous PR: #10273
Since I accidentally fetched/updated from main instead of 6.6 branch

This is a clean PR with the same changes but addressed the previous comments:

  • Removed the copyright headers from my changes since Oracle has been added as a corporate contributor.
  • Addressed comments for 'initializeFunctionRegistry()'

Let me know any other comment.

Thanks

@carlblan carlblan changed the title Oracle TimesTen 6.6 Dialect Updates Oracle TimesTen Dialect for Hibernate 6.6 Updates Jul 8, 2025
@@ -143,4 +145,56 @@ protected boolean supportsRowValueConstructorSyntaxInInList() {
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
return false;
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is only used in TimesTen, could you please remove it from AbstractSqlAstTranslator?

@carlblan carlblan force-pushed the timesten_dialect_updates branch from 7a81939 to a526f53 Compare July 28, 2025 21:55
try {
if ( fetchClauseExpression != null ) {
// We need to substract 1 row to fit maxRows
renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does TimesTen not support a parameter here?

Suggested change
renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 );
renderFetchPlusOffsetExpressionAsSingleParameter( fetchClauseExpression, offsetClauseExpression, -1 );

"sysdate", new CurrentFunction("sysdate", "sysdate", timestampType)
);
functionContributions.getFunctionRegistry().register(
"getdate", new StandardSQLFunction("getdate", StandardBasicTypes.TIMESTAMP)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"getdate", new StandardSQLFunction("getdate", StandardBasicTypes.TIMESTAMP)
"getdate", new CurrentFunction( "getdate", "getdate", timestampType )

Comment on lines +253 to +225
functionContributions.getFunctionRegistry().register(
"trunc", new StandardSQLFunction("trunc")
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
functionContributions.getFunctionRegistry().register(
"trunc", new StandardSQLFunction("trunc")
);
functionContributions.getFunctionRegistry().register(
"trunc",
new OracleTruncFunction( functionContributions.getTypeConfiguration() )
);
functionContributions.getFunctionRegistry().registerAlternateKey( "truncate", "trunc" );

Comment on lines +256 to +229
functionContributions.getFunctionRegistry().register(
"round", new StandardSQLFunction("round")
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
functionContributions.getFunctionRegistry().register(
"round", new StandardSQLFunction("round")
);
functionFactory.round();

Copy link
Member

@beikov beikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to reuse the existing CommonFunctionFactory methods as much as possible, since they also contain parameter type inference information and other extras that you are missing right now.

@carlblan carlblan force-pushed the timesten_dialect_updates branch from a526f53 to 4cc3ccf Compare August 8, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants