I'm getting Unable to acquire JDBC Connection exception

After trying several approaches for a while I found two ways to get this working.

  1. Create a new EntityManager via EntityManagerFactory and use EntityManager.close() method.

  2. Just annotate the repository method with @Transactional annotation as suggested in @Procedure annotation orphaning database connections (spring-data-jpa). I know a repository is not the best place to put a @Transactional annotation but it worked like charm.

Maybe you might want to mark this post as a duplicate, but anyway, my first solution seems to be working too.

Thanks!