UnexpectedRollbackException for NonNullableFieldWasNullException when using @Transactional #927
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
We want to use the
@Transactional
annotation in order to have one transaction byQuery
orMutation
. We added this annotation to a customAsyncExecutionStrategy
.It works fine except for some exceptions, for example :
NonNullableFieldWasNullException
. This exception is not logged, it is only visible in the GraphQL response. Without the transactional annotation we have the correct response containing the error. But with the transactional annotation we didn't, anUnexpectedRollbackException
is thrown. In this case the error is not logged and we have no idea of what is wrong.We push a repository to reproduce the problem : https://github.com/viico/unexpectedrollbackexception. You can clone it, the class ProjectQueryResolverTest contains a test which should pass. It passes if we comment the transactional annotation (line 19 of TransactionalAsyncExecutionStrategyWithExceptionHandler class).
In the repo the exception
NonNullableFieldWasNullException
is thrown because we have a null field (label) which must not be null in the GrapQL schema.For people who have the same problem : we have a workaround, you can log the error before
UnexpectedRollbackException
is thrown. The problem is still here but you have a log with the correct error, you can add the log in the customAsyncExecutionStrategy
:The text was updated successfully, but these errors were encountered: