Skip to content

Oracle SQL hints are ignored as comments in ScriptUtils [SPR-15389] #19952

Open
@spring-projects-issues

Description

@spring-projects-issues

Oded Shopen opened SPR-15389 and commented

ScriptUtils executeSqlScript() method has a default comment delimiter of /* and */.

This markers are used by Oracle for hints. For example:

SELECT /*+ DRIVING_SITE (BA) leading (BA S SR) FULL(BA) PARALLEL(BA 4) PARALLEL(S 4) PARALLEL(SR 4) */ BA.CUSTOMER FROM.....

These hints, when added, are crucial for db performance in production. We recently noticed in a production environment that these hints in an SQL file executed by ScriptUtils was ignored. After looking at the code, we saw that the hints were simply removed.

We solved this issue by calling the overloaded executeSqlScript method that takes specific delimiters, and used "fake" delimiters (##/* and */##) in order to get the hints working again. However, I feel this should not be the correct approach as default.

Suggestions would be:

  • Implement a different behavior based on the JDBC driver being used: In case of Oracle, don't ignore these "comments".

  • Alternatively, Take into account the full /*+ marker as not being a comment (although that might not be a solution for all Oracle hints).


Reference URL: http://stackoverflow.com/questions/33144628/springs-scriptutils-ignores-code-containing-comments-in-dump

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions