JaversAuditableRepositoryAspect does not properly handle thrown exceptions #355
Labels
Comments
bartoszwalacik
added a commit
that referenced
this issue
Apr 13, 2016
…hrown exceptions Solution is to use @AfterReturning which only runs on a noraml method exit, and @AfterThrowing which checks if @transactional was used on the @repository method, and if noRollbackFor or noRollbackForClassName is configured (still commit even if these Exceptions/Throwables are thrown) and matches the current Throwable, still proceed with the versioning.
fixes merged to master, waiting for release |
released in 1.6.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javers Spring support uses JaversAuditableRepositoryAspect on Spring-Data
@Repository
classes for@JaversAuditable
or the Spring-DataCrudRepository
interface. If an exception is thrown from one of those methods, then JaversAuditableRepositoryAspect, which uses@After
will still execute and try and perform a versioning. According to Spring AOP Docs,@After
will always execute, regardless of if there was an exception thrown or not.@AfterReturning
instead executes only if the method returns normally.Here's the original StackOverflow question for reference.
The text was updated successfully, but these errors were encountered: