简体   繁体   中英

How to set JPA Eclipse Link connection timeout?

我正在使用带有eclipse链接的jpa,并且网络连接较差时我的应用程序引发异常,我想增加超时时间或此问题的另一种解决方案

use this in a query

 query.setHint(QueryHints.JDBC_TIMEOUT, x);

Edit: you can set or override javax.persistence.query.timeout by query.setHint("javax.persistence.query.timeout", x); but the hint can be not considered in the case of different databases or different persistence providers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM