hibernate-orm
hibernate-orm copied to clipboard
fix(HHH-17700): manage semicolon chars for sql 'offset/limit' SQL statement inserts
Fixes SqlGrammarException [Incorrect syntax near offset] thrown when executing a paginated SQL native query that contains semicolon characters, in a parameterized query with variables executed in a mssql server for example.
https://hibernate.atlassian.net/browse/HHH-17700
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: [35309327cfc35e98a44c512f91bac15508736536]
› This message was automatically generated.
This change should not be merged without further discussion. To the best of my knowledge we've never said that createNativeQuery()
can be used to execute arbitrary fragments of T-SQL. In my opinion, it's quite clear that it's meant to be used to execute a single SQL DML statement.
And if we are going to start supporting the execution of scripts, then:
- this isn't the API I would use for it—
createStoredProcedureQuery()
is I guess a more appropriate API, or perhaps even something new, and - I don't think I would let you call
setMaxResults()
when what you're passing is a script rather than a single query.
Whether I'm right or wrong on those points, this needs further discussion.