0

実装したい、クエリタイムアウト。アプリケーションフレームワークは、SpringMVCとhibernateで構成されています。

セッションファクトリでタイムアウトを指定している場合。エラーが発生しますタイムアウトはPostgresqlドライバーに実装されていません

私はpostgres8.4を使用しています

コードは次のとおりです。

@Override
@Transactional(timeout=20)
public List<MasterBooking> searchMasterBookings(---){//some more code}

エラースタックトレースは次のとおりです。

SQL state [0A000]; error code [0];Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.; nested exception is org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.

どうすればこれを実装できますか?

4

1 に答える 1

1

postgresドライバーはこのメソッドを実装していません。詳細については、 http://archives.postgresql.org/pgsql-bugs/2008-04/msg00161.phpも参照してください。解決策の要求はTODOリストにあります。

たとえばC3P0のような接続プールを使用すると、制御されたタイムアウト動作をはるかに優れた方法で実装できます。

于 2012-10-10T13:04:10.693 に答える