【问题标题】:jdbcTemplate setQueryTimeout value typejdbcTemplate setQueryTimeout 值类型
【发布时间】:2020-05-20 10:03:30
【问题描述】:

我想知道我们需要在public void setQueryTimeout(int queryTimeout) 中传递jdbcTemplate 中的值的类型。文件说

> Set the query timeout for statements that this JdbcTemplate executes.
> <p>Default is -1, indicating to use the JDBC driver's default (i.e. to
> not pass a specific query timeout setting on the driver). <p>Note: Any
> timeout specified here will be overridden by the remaining transaction
> timeout when executing within a transaction that has a timeout
> specified at the transaction level. @see
> java.sql.Statement#setQueryTimeout

想知道 queryTimeoutmillisecondsseconds 还是 minutes

【问题讨论】:

  • 奇怪的是它没有指定是秒还是毫秒。您必须基于互联网上人们的解决方案。 :)
  • @Young Emil `Statement.setQueryTimeout` 提到输入参数的单位
  • @mantri,我认为这个问题针对的是JdbcTemplate.setQueryTimeout,而不是Statement 类。

标签: java jdbc java-8 jdbctemplate query-timeout


【解决方案1】:

在检查了来自java.sql.Statement 类的类似setQueryTimeout() 之后,我猜它们的行为相同。

setQueryTimeout(int seconds)

解决类似问题的一个好方法是查看互联网上的一个工作示例。很有帮助!

【讨论】:

  • 我对这个答案投了赞成票,因为该函数存在并且我能够毫无错误地对其进行编码。但是,在实施之后,它似乎并没有在期限之后超时。
猜你喜欢
  • 2021-06-15
  • 2016-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-05
  • 2015-11-20
  • 2021-11-05
  • 2016-11-30
相关资源
最近更新 更多