-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
base: 6.6
Are you sure you want to change the base?
Changes from all commits
e6f5c1e
27e72ac
0e517d9
f859b93
fb08af3
8a8354a
894124a
dfdfbcb
8658705
fe8b24d
197ee03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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,55 @@ protected boolean supportsRowValueConstructorSyntaxInInList() { | |||||
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() { | ||||||
return false; | ||||||
} | ||||||
|
||||||
protected void renderRowsToClause(Expression offsetClauseExpression, Expression fetchClauseExpression) { | ||||||
// offsetClauseExpression -> firstRow | ||||||
// fetchClauseExpression -> maxRows | ||||||
final Stack<Clause> 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 ) { | ||||||
// We have an offset. We use 'SELECT ROWS m TO n' 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 { | ||||||
if ( fetchClauseExpression != null ) { | ||||||
// We need to substract 1 row to fit maxRows | ||||||
renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 ); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does TimesTen not support a parameter here?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried using 'renderFetchPlusOffsetExpressionAsSingleParameter()'. But it doesn't work as expected, that's why I ended using the 'AsLiteral' version. Let me explain... It seems like if I use: The third parameter 'int offset' which is set to '-1' is not being added to the calculation. The end resultSet has 'rowsLimit +1 row'. But If I use 'renderFetchPlusOffsetExpressionAsLiteral()' with the 'int offset=-1' my end resultSet has exactly the 'rowsLimit' size. Which is what we want. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the implementation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, we are testing it like:
And this fails with: Note: the table contains 300 rows we expected to have 93 books (MaxRowsLimit) |
||||||
} | ||||||
else{ | ||||||
// We dont have a maxRows param, we will just use a MAX_VALUE | ||||||
appendSql( Integer.MAX_VALUE ); | ||||||
} | ||||||
} | ||||||
finally { | ||||||
clauseStack.pop(); | ||||||
} | ||||||
} | ||||||
|
||||||
appendSql( WHITESPACE ); | ||||||
} | ||||||
} |
Uh oh!
There was an error while loading. Please reload this page.