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 6 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: [c0d86b2, cfe66c4, 470845b, a41b2da, f20e73e, 7a81939]

› 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
Comment on lines +144 to +149
case SqlTypes.BLOB:
return "BLOB";
case SqlTypes.CLOB:
return "CLOB";
case SqlTypes.NCLOB:
return "NCLOB";
Copy link
Member

Choose a reason for hiding this comment

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

If you look at the Dialect implementation, you will notice that the LOB handling here is redundant.

case SqlTypes.TINYINT:
return "tt_tinyint";
return "TT_TINYINT";
Copy link
Member

Choose a reason for hiding this comment

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

Please revert the all type names in this function to lower case again.

}
}
else if ( offsetClauseExpression != null && fetchClauseExpression == null ) {
throw new UnsupportedOperationException(
Copy link
Member

Choose a reason for hiding this comment

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

Can't you use e.g. Integer.MAX_VALUE then?

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

@@ -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?

Comment on lines +138 to +139
case SqlTypes.TIMESTAMP:
return "TIMESTAMP";
Copy link
Member

Choose a reason for hiding this comment

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

No need to do this, as the Dialect implementation already handles timestamp.

Suggested change
case SqlTypes.TIMESTAMP:
return "TIMESTAMP";

Comment on lines +113 to +124
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)";

Copy link
Member

Choose a reason for hiding this comment

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

Only need to handle the varchar type.

Suggested change
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)";
case SqlTypes.LONGVARCHAR:
return "varchar2($l)";

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