-
Notifications
You must be signed in to change notification settings - Fork 356
Duplicate key column in selection #1779
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
Comments
Please provide a Minimimal Reproducable Example, preferable as a Github repository. Make sure to include the database, either as an in memory database or if that is not possible using Testcontainers. |
I couldn't reproduce issue with H2 so i had to use Testcontainers+db2. https://github.com/mivanus/spring-data-retional-issue-1779 |
This might be related to #1680 I was able to reproduce this with DB2. For example: SELECT
"BBB"."ID" AS "ID",
"BBB"."NAME" AS "NAME",
"BBB"."AAA_ID" AS "AAA_ID",
"ccc"."ID" AS "ccc_ID",
"ccc"."NAME" AS "ccc_NAME",
"ccc"."BBB_ID" AS "ccc_BBB_ID",
"BBB"."ID" AS "ID"
FROM "BBB" LEFT OUTER JOIN "CCC" "ccc" ON "ccc"."BBB_ID" = "BBB"."ID" WHERE "BBB"."AAA_ID" = ? ORDER BY "ID" |
After some more investigation, there are a couple of things wrong with the mapping. The relation between Also if If you have further questions about fixing the mapping I recommend asking on SO. With the If you think there is still an error with the SQL generation, please provide an updated reproducer. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
In some cases select statement contains duplicate key columns which causes BadSqlGrammarException when "order by" gets included in sql.
Code that causes duplication:
spring-data-relational/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java
Lines 537 to 539 in 21e8d9a
The text was updated successfully, but these errors were encountered: