Skip to content

SqlParserQueryEnhancer errors with Merge statements #2641

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

Closed
gderemetz opened this issue Sep 23, 2022 · 6 comments
Closed

SqlParserQueryEnhancer errors with Merge statements #2641

gderemetz opened this issue Sep 23, 2022 · 6 comments
Assignees
Labels
in: query-parser Everything related to parsing JPQL or SQL type: enhancement A general enhancement

Comments

@gderemetz
Copy link
Contributor

Hello

similar to #2593

With spring boot >= 2.7, the application failed to start because of merge statement (oracle syntax)

class net.sf.jsqlparser.statement.merge.Merge cannot be cast to class net.sf.jsqlparser.statement.select.Select (net.sf.jsqlparser.statement.merge.Merge and net.sf.jsqlparser.statement.select.Select are in unnamed module of loader 'app')

for exemple in a JPA repository

@Modifying
@Query(value = "merge into ...", nativeQuery = true)
void mergeStatement();

detectParsedType() in JSqlParserQueryEnhancer appears to neglect the Merge statement which is supported by Jsqlparser

@gregturn
Copy link
Contributor

@DiegoKrupitza Is this a scenario you're familiar with?

@gregturn gregturn self-assigned this Sep 23, 2022
@gregturn gregturn added the in: query-parser Everything related to parsing JPQL or SQL label Sep 23, 2022
@DiegoKrupitza
Copy link
Contributor

@DiegoKrupitza Is this a scenario you're familiar with?

I will take a look at this! I have seen that @xercasy has already proposed a PR for this (#2642).

@DiegoKrupitza
Copy link
Contributor

@gregturn As realized thanks to the issue #2593 I did not implement all the possible Statements JSqlParser can handle. In #2595 I added support for INSERT. Thanks to @xercasy the PR #2642 will fix it with MERGE.

I already reviewed the PR #2642 and as far as I can see it should fix the problem.

gderemetz added a commit to gderemetz/spring-data-jpa that referenced this issue Sep 23, 2022
@gregturn gregturn added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 26, 2022
gderemetz added a commit to gderemetz/spring-data-jpa that referenced this issue Sep 27, 2022
gregturn added a commit that referenced this issue Sep 27, 2022
Related: #2641.
@gregturn
Copy link
Contributor

Thanks to @xercasy and @DiegoKrupitza, this additional support for native MERGE operations is now merged to main.

@gregturn gregturn added this to the 3.0 RC1 (2022.0.0) milestone Sep 27, 2022
@gderemetz
Copy link
Contributor Author

@gregturn Can you backport this issue and #2593 to 2.7.x ? Thanks

@gregturn
Copy link
Contributor

Backported to 2.7.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: query-parser Everything related to parsing JPQL or SQL type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants