You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing ReactiveMongoRepository/ReactiveCrudRepository with spring-boot-starter-data-mongodb-reactive and declaring suspend find function with non-nullable kotlin return types, the repository returns null when it can't find an entity instead of EmptyResultDataAccessException.
Here is the fun declaration: suspend fun findSomeEntitiesById(id: Long): SomeEntity
And this test prints null when called with id that does not exists:
@Test internal fun returnsNllReference() { runBlocking { println(repositoryMy.findSomeEntitiesById(123)) } }
If I replace spring-boot-starter-data-mongodb-reactive with spring-boot-starter-data-r2dbc, it throws
org.springframework.dao.EmptyResultDataAccessException: Result must not be null!
The text was updated successfully, but these errors were encountered:
The MethodInvocationValidator introspects the return value from coroutine invocations. In that case we see CoroutineSingletons.COROUTINE_SUSPENDED being returned and we cannot perform any further validations. I'm not sure how to proceed here. Maybe @sdeleuze can provide additional guidance on how to either intercept the continuation or how we can post-process the emitted/not-emitted value from the continuation.
When writing ReactiveMongoRepository/ReactiveCrudRepository with spring-boot-starter-data-mongodb-reactive and declaring suspend find function with non-nullable kotlin return types, the repository returns null when it can't find an entity instead of EmptyResultDataAccessException.
Here is the fun declaration:
suspend fun findSomeEntitiesById(id: Long): SomeEntity
And this test prints null when called with id that does not exists:
@Test internal fun returnsNllReference() { runBlocking { println(repositoryMy.findSomeEntitiesById(123)) } }
If I replace spring-boot-starter-data-mongodb-reactive with spring-boot-starter-data-r2dbc, it throws
org.springframework.dao.EmptyResultDataAccessException: Result must not be null!
The text was updated successfully, but these errors were encountered: