spring-projects / spring-projects/spring-data-relational
Support `suffix` for `@Embedded`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 827
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
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_namehome_phone,work_phone,mobile_phonemin_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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the @Embedded mapping implementation and the existing handling for its prefix attribute. Trace how embedded column names are derived, then identify the tests covering prefix behavior. Done means suffix works for the Statistics example and the existing prefix behavior remains unchanged, with coverage for suffix and combined prefix/suffix cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100