I am using spring data jpa in our application. I want to throw timeout exception, if database does not respond. How can we set timeout in simple jpa queries, without using entity manager ?
Regards, Stephan
I am using spring data jpa in our application. I want to throw timeout exception, if database does not respond. How can we set timeout in simple jpa queries, without using entity manager ?
Regards, Stephan
Did you try spring.jpa.properties.javax.persistence.query.timeout=60000
in application.properties
?
If your problem still exists try to add Spring Transaction annotation like the below code.
@Transactional(timeout=10)
@Override
public List<EntityModel> function(EntityModel model) {
}