-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuetype: bugA general bugA general bug
Description
A simple setup with a UUID as id:
class Entity {
@Id
@Column("ID")
private UUID id;
}@Repository
class Repo extends ReactiveCrudRepository<Entity, UUID> {
}
The following fails repo.findAllById(List.of(existingUuid))
The same happens using the database client: client.select().from(Entity.class).matching(Criteria.where("id").in(List.of(existingUuid))).fetch().all()
Error: java.lang.IllegalArgumentException: Cannot encode null parameter of type java.lang.Object
java.lang.IllegalArgumentException: Cannot encode null parameter of type java.lang.Object
at io.r2dbc.postgresql.codec.DefaultCodecs.encodeNull(DefaultCodecs.java:155) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Stack trace:
at io.r2dbc.postgresql.codec.DefaultCodecs.encodeNull(DefaultCodecs.java:155) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
at io.r2dbc.postgresql.ExtendedQueryPostgresqlStatement.bindNull(ExtendedQueryPostgresqlStatement.java:113) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
at io.r2dbc.postgresql.ExtendedQueryPostgresqlStatement.bindNull(ExtendedQueryPostgresqlStatement.java:45) ~[r2dbc-postgresql-0.8.0.RELEASE.jar:0.8.0.RELEASE]
at org.springframework.data.r2dbc.core.DefaultDatabaseClient$StatementWrapper.bindNull(DefaultDatabaseClient.java:1579) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.dialect.IndexedBindMarker.bindNull(IndexedBindMarker.java:56) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.dialect.Bindings$NullBinding.apply(Bindings.java:281) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.dialect.Bindings.lambda$apply$1(Bindings.java:122) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:na]
at org.springframework.data.r2dbc.dialect.Bindings.apply(Bindings.java:122) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.core.DefaultStatementMapper$DefaultPreparedOperation.bindTo(DefaultStatementMapper.java:314) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.core.DefaultDatabaseClient$ExecuteSpecSupport.lambda$exchange$1(DefaultDatabaseClient.java:341) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at org.springframework.data.r2dbc.core.DefaultDatabaseClient.lambda$null$17(DefaultDatabaseClient.java:1429) ~[spring-data-r2dbc-1.0.0.RELEASE.jar:1.0.0.RELEASE]
at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:46) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
at reactor.core.publisher.Flux.subscribe(Flux.java:8134) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
at reactor.core.publisher.FluxUsingWhen$ResourceSubscriber.onNext(FluxUsingWhen.java:201) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
at org.springframework.security.test.context.support.ReactorContextTestExecutionListener$DelegateTestExecutionListener$SecuritySubContext.onNext(ReactorContextTestExecutionListener.java:105) ~[spring-security-test-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73) ~[reactor-core-3.3.0.RELEASE.jar:3.3.0.RELEASE]
One of the problems here is (from SimpleR2dbcRepository):
StatementMapper.SelectSpec selectSpec = mapper.createSelect(this.entity.getTableName()) //
.withProjection(columns) //
.withCriteria(Criteria.where(idColumnName).in(ids));
idColumnName contains ID instead of id (the value from the @Column annotation), if I change the value to "id", I do not get an exception but this warning:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.util.ReflectionUtils (file:/home/dav1d/.m2/repository/org/springframework/spring-core/5.2.1.RELEASE/spring-core-5.2.1.RELEASE.jar) to constructor java.util.UUID(byte[])
WARNING: Please consider reporting this to the maintainers of org.springframework.util.ReflectionUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
And no results. But if I change the criteria from .in to .is the entity is found.
Metadata
Metadata
Assignees
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuetype: bugA general bugA general bug