spring-projects / spring-projects/spring-data-relational
Add support for @JoinColumn
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 827
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I love the simplicity of spring-data-jdbc, but sometimes it feels too restrictive compared to possibilities of JPA. I miss the @JoinColumn feature.
Please let me describe my need for it
class Order {
@Id
String id; // technically, randomly generated value without _any_ business meaning, e.g. UUID
String reference ; // some kind of business information encoded in the value and it is _unique_ (!)
@MappedCollection
Set<OrderItem> orderItems;
// might be a better name compared to @JoinColumn
//@MappedColumn
@JoinColumn("reference") // <== not using the "id" field
private Meta meta;
}
class OrderItem {
@Id
Long id; // technical id
String orderId; // back reference to Order
}
class Meta {
@Id
String reference;
String data;
}
I have use cases, where relations are either based on that unique field/property/column or on another unique field/property/column.
I tried to use the NamingStrategy to achieve my goal, but it didn't work either.
best regards
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 reviewing the existing NamingStrategy path and the Order/Meta mapping example in the issue. Trace how relational associations currently choose their referenced column, then identify the tests and mapping entry points that would need coverage for a unique non-id column. Done means spring-data-jdbc supports the requested @JoinColumn-style association without relying on NamingStrategy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100