Skip to content

Add support for @JoinColumn #1952

Open
Open
@rfelgent

Description

@rfelgent

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions