Closed nikobearrr closed 4 years ago
Thanks for the detailed issue report. You are using Spring Data JPA which is managed as a separate project. They use JIRA for issue tracking. Can you please open an issue over there and comment here with a link to it so that we can follow along?
Hi @wilkinsona, thanks for letting me know. I have created an issue here: https://jira.spring.io/browse/DATAJPA-1763
And based on what Mark said in the JPA issue, it's not up to Spring JPA. So I have opened a new issue at hibernate here: https://hibernate.atlassian.net/browse/HHH-14122
We are trying to update our springboot application from 2.1.0 to 2.3.2 All goes good except for some specific queries that we have. Our queries work up until 2.1.16, but not on 2.2.0
Our query is as following:
For springboot <= 2.1.16 that works. For springboot >= 2.2.0 it throws:
org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [delete from main_table cross join special special1_ where id=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
I tried to read the release notes of 2.2.0 here, but I cannot find anything related to this, thus I think it might be a bug.
When I run both versions (2.1.16 and 2.2.0) with
spring.jpa.show-sql=true
I can see it produces different queries:2.1.16:
Hibernate: delete from MainTable where special=?
2.2.0:Hibernate: delete from MainTable cross join Special special1_ where id=?
Minimal setup to replicate the issue is as following:
MainTable:
Special:
MainTableRepository:
SpecialRepository:
Test:
test application.properties:
pom.xml:
That test passes when ran with the lower version of springboot, but fails with 2.2.0, 2.2.9, 2.3.0 and 2.3.2
This is the full exception: