> On Jun 20, 2019, at 10:33 AM, zhengyan <zhengyan...@gmail.com> wrote:
>
> Hi, I'm using the Cayenne3.1.2 version .
> I want to set the QueryTimeout parameter , like the parameter in
> JDBC setQueryTimeout(5);
> Where I can set this parameter in Cayenne3.1.2?
>
> Thanks !
Hi,
Unfortunately there's no direct way to do it, and you will have to implement
some roundabout approach:
1. Your connection pool may support a default query timeout. E.g. DBCP has
"defaultQueryTimeout" config parameter.
2. You may need to subclass your SelectQuery, to implement a custom
"createSQLAction" method, them subclass your DB-specific SelectAction to
control the Statement.
The second solution would require poking inside a few Cayenne internals, but is
not as scary as it may seem :)
Also I made a note to explore exposing JDBC Statements in some way for user
customization, so hopefully the future versions of Cayenne will allow for a
more direct approach.
Andrus
[1] https://commons.apache.org/proper/commons-dbcp/configuration.html