Add support for composite Id's
No way to specify composite id for usage ReactiveCrudRepository
We depend on upstream feature availability in Spring Data Relational for composite Id's, see DATAJDBC-352.
any idea when it will be done?
No, we don’t have this feature scheduled yet as we’re busy with other tasks. A pre-requisite is the composite I’d support in Spring Data Relational as the R2DBC module depends on a shared library.
Can you suggest any workaround for this until it's done?
edit: I just skipped these annotations, used one element of the composite primary key as a "key" for Repository and used custom query with @Query annotation. Nevertheless, it would be nice to have that feature to make Repository definition right without workarounds.
edit 2: I handled composite key with Tuple2 object. This is kind of workaround, which allows me to reflect schema of the table with composite primary key in the java repository interface and entity class.
@pwittchen do you mind to explain how did you did it with Tuple2?
@porfirioribeiro
Something like this:
@Repository
public interface UserRepository extends R2dbcRepository<User, Tuple2<BigDecimal, String> {
//...
}
I know, this is kind of workaround and won't work with Repository methods provided out of the box like findById(Id) etc. and you need to write custom methods with custom queries anyway, but I keep it for code documentation purposes to avoid providing any (non-composite) key, which is not real database key just to satisfy interface signature and introduce inconsistency between java code in the repository and database schema.
this is still forgotten =/
@pwittchen Can you please give a reference to your code?
@palaknagda Code related to my comment is proprietary and is not open-source. You can see a general idea in my code snippet in the earlier comment. Nevertheless, it does not solve this problem and query inside @Query annotation should work regardless of this change.
Any updates???
Still depends on spring-projects/spring-data-relational#574. A well-crafted pull request along with a decent design can always speed things up.
More than 3 years later, no updates so far?