Skip to content

using abstract Base-Entity: ResultSet contains ID multiple times [DATAJDBC-579] #799

Closed as not planned
@spring-projects-issues

Description

@spring-projects-issues

Clemens Hahn opened DATAJDBC-579 and commented

I'm working with an abstract base entity model

abstract class BaseEntity(@Id open val id: Long?)

My concrete model extends this base entity like

data class Ticket(
        override val id: Long? = null,
        val title: String,
        val comments: MutableSet<Comment>
) : BaseEntity(id)

When reading from the TicketRepository I got the warning WARN 4594 — [ main] o.s.d.j.core.convert.ResultSetAccessor : ResultSet contains ID multiple times.

I also noticed that the ID field is two times present in the query: DEBUG 4594 — [ main] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL statement [SELECT "TICKET"."ID" AS "ID", "TICKET"."ID" AS "ID", "TICKET"."TITLE" AS "TITLE" FROM "TICKET" WHERE "TICKET"."ID" = ?]

Is it possible to use base entities? I did not noticed this warning in spring-data-jdbc 1.1.5.RELEASE (but also the duplicate ID in the SELECT statement).

Please feel free to use my showcase in order to reproduce this scenario at GitHub (ticket/DATAJDBC-579 branch)


Affects: 2.1 M1 (2020.0.0)

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions