How to set a default query timeout with JPA and Hibernate?

前端 未结 5 1494
南方客
南方客 2020-11-29 10:10

I am doing some big queries on my database with Hibernate and I sometimes hit timeouts. I would like to avoid setting the timeout manually on every Query or

5条回答
  •  半阙折子戏
    2020-11-29 11:00

    JPA 2 defines the javax.persistence.query.timeout hint to specify default timeout in milliseconds. Hibernate 3.5 (currently still in beta) will support this hint.

    See also https://hibernate.atlassian.net/browse/HHH-4662

提交回复
热议问题