Skip to content

IllegalArgumentException on deleteAll with CompositeKeys: Value of property id is not an instance of ... but java.util.ArrayList #2208

@MarvinLira

Description

@MarvinLira

I experimented a bit with r2dbc and the new composite keys, however I did not pass my integration tests where I got an error when deleting multiple rows at once using deleteAll. I am using spring boot 4.0.1, spring-boot-starter-data-r2dbc, and postgresql.

I simplified my issue to the attached files where running the test results in an IllegalArgumentException.

java.lang.IllegalArgumentException: Value of property id is not an instance of failure.Entity$EntityKey but java.util.ArrayList

	at org.springframework.data.r2dbc.query.QueryMapper.getEmbeddedPropertyAccessor(QueryMapper.java:442)
	at org.springframework.data.r2dbc.query.QueryMapper.mapCondition(QueryMapper.java:374)
	at org.springframework.data.r2dbc.query.QueryMapper.getCondition(QueryMapper.java:338)
	at org.springframework.data.r2dbc.query.QueryMapper.unroll(QueryMapper.java:279)
	at org.springframework.data.r2dbc.query.QueryMapper.getMappedObject(QueryMapper.java:258)
	at org.springframework.data.r2dbc.core.DefaultStatementMapper.getMappedObject(DefaultStatementMapper.java:250)
	at org.springframework.data.r2dbc.core.DefaultStatementMapper$DefaultTypedStatementMapper.getMappedObject(DefaultStatementMapper.java:352)

With debugging I saw that the criteria which fails to be mapped is "id IN ('EntityKey[part1=1, part2=1]', 'EntityKey[part1=1, part2=2]')".

schema.sql
Entity.java
EntityRepository.java
EntityTest.java

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions