Skip to content

Spring Data JDBC @Embeded prefix not supported #113

@bozotegeltija

Description

@bozotegeltija

When constructing the query, the "prefix" field of the @Embedded annotation is not respected. For example:
Let's say you have an entity:

@Table("matches")
record Match(
    Integer matchId,
    @Embedded(onEmpty = USE_NULL, prefix = "player1_")
    Player playerOne,
    @Embedded(onEmpty = USE_NULL, prefix = "player2_")
    Player playerTwo
) {}

record Player(
    Integer id,
    String name
) {}

If you invoke a method from a repository that extends QuerydslJdbcFragment in this fashion:

    repository.queryMany(q -> q.select(this.entityProjection()).from(player));

You will get an exception ERROR: column match.id does not exist .

It probably gets the id from the player embedded object, but ignores the prefix. The method should instead include columns player1_id, player1_name, player2_id, player2_name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions