If you can reproduce your hanging issue, then get a stack trace and determine the issue. Obviously if it's stuck in some JDBC call, it's a problem with the driver.
It's highly likely your problem is with Postgres, but it would be nice to have a correct example configuration for persistence in the future.
This question has been asked enough times now that I created an FAQ
The solution is talk to your database admin.
and also to use search so we don't have to continually repost these answers,
where we even bother to answer these redundant questions.