playframework/Play20 — pull request #689 by brikis98 (2013-01-21 20:31:09+00:00)
Title: Expose a withTimeout method in anorm

This PR adds a `withTimeout` method to anorm so it's possible to set a query timeout on DB calls. This uses [Statement.setQueryTimeout](http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout(int\)) under the hood.

A question for reviewers:

1. Is there any way to unit test this? I couldn't find any unit tests for anorm and I have no clue how to simulate a slow DB query.
2. Is there any way for anorm to get a config parameter so it would be possible to set a timeout for *all* DB queries? It looks like anorm is intentionally kept separate from Play code, so I can't exactly do `Play.current.configuration.getInt(...)`.