Skip to content

Support suffix for @Embedded #2303

Description

@SquidXTV

Problem

Spring Data Relational's @Embedded currently only supports a prefix attribute to group multiple columns belonging to an embedded type (class/record). This works well where a common prefix is the natural grouping mechanism given by the language. However, there are some cases where a common suffix is the natural way to group these columns, and where suffix attribute on @Embedded would make the mapping more intuitive.

Examples

  • first_name, last_name
  • home_phone, work_phone, mobile_phone
  • min_age, max_age, median_age, avg_age

Use case could look like this:

record Statistics(int min, int max, int median, int average) {}

@Embedded(suffix = "_age") Statistics ageStatistics

There might even be use cases where both prefix and suffix together form the natural way of grouping things together in the english language. Couldn't come up of concrete examples there though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions