The answer might vary depending on your specific use case. One way to do it
would be to:

1) start an explicit transaction,
2) run a query to set the timeout
            SQLExec.*query*("set statement_timeout = 60000").execute(context
);
3) do your work
4) run a query to reset or unset the timeout
5) commit

TransactionFactory txFactory = CayenneRuntime.*getThreadInjector*
().getInstance(TransactionFactory.*class*);

Transaction tx = txFactory.createTransaction();

tx.begin();

*try* {

... // do stuff


tx.commit();

} *catch* (Exception e) {

tx.rollback();

*throw* e;

}


On Tue, Nov 10, 2020 at 7:50 AM Mark Stobbe <markstobb...@gmail.com> wrote:

> Hi all,
>
> Can we have an option to set query timeout on the metadata of the query,
> similar to the statementFetchSize?
>
> The workaround seems to involve a lot of subclasses via the adapter; or via
> the connection but then I need to have the same timeout for all statements
> or parse SQL to identify query..
>
> Best regards,
> Mark
>

Reply via email to