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

Support Composite ID in R2DBC

Open schauder opened this issue 10 months ago • 1 comments

This needs #2011 first.

schauder avatar Mar 13 '25 11:03 schauder

Related to #574

schauder avatar Mar 13 '25 11:03 schauder

Any news now that issue 574 is closed?

ZYMCao avatar Jul 06 '25 13:07 ZYMCao

This was done as part of #574.

schauder avatar Jul 07 '25 06:07 schauder

This was done as part of #574.

I was using

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>io.r2dbc</groupId>
        <artifactId>r2dbc-h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-r2dbc</artifactId>
    </dependency>

and it did not work for my table (H2) of

CREATE TABLE IF NOT EXISTS FILE_META ( FILE_ID uuid not null, TS BIGINT not null, USER_ID varchar(64) not null, FILE_NAME varchar(128), VECTORIZED boolean not null, MIMETYPE varchar(128), URI varchar(256), PRIMARY KEY (FILE_ID, TS) );

until I changed from spring-boot-starter-data-r2dbc to spring-boot-starter-data-jdbc. The error occurs when I tried to call save method of FileMetaRepository (which extends ReactiveCrudRepository) for data insertion. My speculation is that it has something to do with custom id generation when id is composite (I used BeforeConvertCallback).

ZYMCao avatar Jul 09 '25 06:07 ZYMCao

Please create a new issue and include a full reproducer.

schauder avatar Jul 09 '25 06:07 schauder

Please create a new issue and include a full reproducer.

https://github.com/spring-projects/spring-data-relational/issues/2096

ZYMCao avatar Jul 19 '25 17:07 ZYMCao