1

I have a use-case where I need to execute some logic asynchronously, after my entity has been updated in database.

I am evaluating option to use JPA listener @PostUpdate method, which will be executed after my entity has been updated in database, but it seems that it blocks the main thread.

Can the logic inside of the @PostUpdate listener method be executed asynchronously?

Django
  • 43
  • 2
  • 10
  • 1
    Inside the @PostUpdate method you can do your logic in separate thread. – Saurabh Singh Jan 30 '21 at 09:43
  • Yes, I assume that can be the only solution. I've even tried to execute Async method in another Spring component from PostUpdate method, but that doesn't work as well. Thanks @Saurabh – Django Jan 31 '21 at 12:05

0 Answers0