spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

R2DBC Composite Primary Key

Open ko-ing opened this issue 3 years ago • 3 comments

Hi, I was wondering if there's any way I can implement composite primary keys on entities when using spring-data-r2dbc. If there's none, is there any plan for addition or is it okay to create PR for it?

I have searched for some issues and changes but only found https://github.com/spring-projects/spring-data-relational/issues/574 and I guess the issue has not been completed.

ko-ing avatar Jun 27 '22 16:06 ko-ing

If I remember correctly, using single primary key is a requirement of the JPA specification. If Spring Data tends to follow the JPA specification, this is clearly an unsolvable problem.👀

linghengqian avatar Jul 07 '22 12:07 linghengqian

@linghengqian

Thanks for comment!

I checked javax.persistence package which refers to jpa specification, and there is @IdClass that specifies a composite primary key for an entity. So, I thought jpa specification provides support for composite primary key.

Please comment back if I got it wrong. And also, I wonder if spring-data-relational repository is not right place to raise this issue?

ko-ing avatar Aug 13 '22 14:08 ko-ing

I don't have much of an idea from this, I'm guessing maybe the bigger limitation comes from Spring Data Commons.

linghengqian avatar Aug 13 '22 14:08 linghengqian

Closing as duplicate of #574

mp911de avatar Sep 13 '23 13:09 mp911de

Any update here. still it cant be use pk with r2dbc or any way now.?

SubhashChamara avatar Nov 12 '23 14:11 SubhashChamara