-
Notifications
You must be signed in to change notification settings - Fork 356
Bug encountered with duplicate column names in result set, but only in specific alias order #1680
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
Hi @edwardmp, thanks for raising this issue, I'll consider the missing warning a bug. This might even be related to #1684 which we fixed with 8a94345. In order to get properly hunting, could you please provide the domain model you are using, i.e. the classes |
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. |
Hey @schauder Here's the domain model: import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.util.UUID
@Table("group")
data class Group(
@Id
val uuid: UUID,
val name: String
) import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import org.springframework.data.relational.core.mapping.Column
import java.util.UUID
@Table("user")
data class User(
@Id
val uuid: UUID,
val name: String,
@Column("group_uuid")
val groupUuid: UUID?
) |
Hey folks,
Noticed a weird bug today.
Suppose I have the following entity structure:
E.g. a root entity
group
and embedded entityuser
.Before I had a query like this, which worked fine using
Spring data JDBC 2.4.16
despite the duplicate columnname
in both entities.There was something logged though
ResultSet contains name multiple times
, but in my case everything worked fine.I remember this from the past, because back then I could not find a proper fix that would remove the warning, however it seemed harmless at the time.
I recently upgraded to
Spring Data JDBC 3.2.0
and this behavior has now changed.There is nothing logged, and the value of the
name
columns is swapped between the entities, e.g. the group entity will have the name of the user, and the user will have the name of the group.Anyhow, I guess it's logical that due to the single
select *
Spring Data JDBC couldn't figure it out, not sure why the warning message no longer is logged though.I found #1073 which might explain this change, and based on this I modified my query to:
Then, everything works as expected.
However I also noticed that if I swap the order of select aliases, the issue appears again:
So I have 2 questions/remarks:
@schauder perhaps you have an idea here since you worked on the related commit.
Edit: I had to downgrade to Spring Boot 3.1.5 (and thus Spring Data JDBC 3.1.5) for other reasons, and now I notice that the issue is inverted again.
E.g. this works:
But swapping
g.*
andu.*
makes it fail here. So exactly inverted of what happens with 3.2.0.. very puzzlingThe text was updated successfully, but these errors were encountered: