Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F7ED173BF for ; Wed, 15 Oct 2014 02:38:51 +0000 (UTC) Received: (qmail 12524 invoked by uid 500); 15 Oct 2014 02:38:51 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 12497 invoked by uid 500); 15 Oct 2014 02:38:50 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 12485 invoked by uid 99); 15 Oct 2014 02:38:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2014 02:38:50 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of malcolm.edgar@gmail.com designates 209.85.218.49 as permitted sender) Received: from [209.85.218.49] (HELO mail-oi0-f49.google.com) (209.85.218.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Oct 2014 02:38:46 +0000 Received: by mail-oi0-f49.google.com with SMTP id a3so275240oib.8 for ; Tue, 14 Oct 2014 19:38:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=c6aq5rsXktdEGCYxnAdRrIyzk8zOUDwyk/JyJc/g3po=; b=lHeh+VOhcQxclQ58vH+TG2ohXnLD207fvtKX9b8+RKXKeNyI+YjI6fF8P1np7N/CRa eMOy0pxSC3YVSepmsQR7BGQ9cZOfOa38QRC4UB4dsFa4mPqLB2UCXwZGsVrBuHtimp/5 2vX2D3LDY6xrYYyhd0PQtjF4349ujcyl08oPnwFnYZlnCArLOKZJbE7GIsOMryaU5Ar8 9l20PfDqd38W886e0ydm0Qh2j6oCraJu2rXLDrlL9Xr/65RxmvD8WREupPaRKIeGUWoE 7GCzAV5d+gVVg1soqr29Q4ROFrQKnI/gA6JNnhn8/9ucM9nG8AxVi2Vf/pbsLVl4vLVq rboA== MIME-Version: 1.0 X-Received: by 10.202.214.69 with SMTP id n66mr7616185oig.9.1413340706069; Tue, 14 Oct 2014 19:38:26 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Tue, 14 Oct 2014 19:38:26 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Oct 2014 13:38:26 +1100 Message-ID: Subject: Re: JDBC Statement Timeout From: Malcolm Edgar To: user Content-Type: multipart/alternative; boundary=001a113d7f74bb768505056d0624 X-Virus-Checked: Checked by ClamAV on apache.org --001a113d7f74bb768505056d0624 Content-Type: text/plain; charset=UTF-8 Hi Guys, I ended up wrapping the JNDIDataSourceFactory, DataSource and Connection classes and configuring this in the domain configuration file. The wrapped Connection class sets the queryTimeout when the Statement objects are created. This flushed out the errors, which we are now working to resolved. Couple of thoughts on this: it would be nice to be able to set the queryTimeout on the SelectQuery class, as this would give you more fine grained control over the execution of statements, rather than having a global setting with what we are doing above. I think probably the better solution for this problem would be for me to use a better Connection pool which will release blocked connections, and allow the database to kill the sessions which are causing deadlocks. The connection pool in JBoss 7.0.2 is pretty basic. Are there any 3rd party connection pools you would recommend for OLTP production usage? thanks Malcolm Edgar On Wed, Oct 15, 2014 at 10:40 AM, Andrus Adamchik wrote: > Yep, that's one way of doing it, though requiring to use a custom query > everywhere. A DI alternative of the same solution is to do something like > this in a custom Module: > > binder.bind(OracleSniffer.class).to(MyOracleSniffer.class); > > MyOracleSniffer would implement DbAdapterDetector which is a decorator of > OracleSniffer. It will return a DbAdapter decorator of the OracleAdapter, > overriding DbAdapter.getAction(..) to set timeouts. > > And yes, we need a better way to do this. But at least this one is > non-invasive in that it doesn't require you to change idiomatic Cayenne > code elsewhere. > > Andrus > > > > On Oct 13, 2014, at 3:00 PM, Emanuele Maiarelli < > maiarelli.emanuele@gmail.com> wrote: > > http://cayenne.195.n3.nabble.com/query-timeout-needed-td1070.html > > > > The link explains the solution for cayenne 1.2. > > > > You can try with cayenne 3.1 being aware that packages named > > org.objectstyle.* have been renamed as org.apache.* > > > > > > > > 2014-10-13 4:50 GMT+02:00 Malcolm Edgar : > > > >> Hi All, > >> > >> I am having some deadlock issues with the Oracle database, and want to > be > >> able to set the JDBC statement timeout. > >> > >> From what I understand this isn't supported in Cayenne 3.1, and I am > after > >> advice on the best way to do this in a Cayenne context. > >> > >> > >> > http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout%28int%29 > >> > >> Thanks in advance for any help. > >> > >> regards Malcolm Edgar > >> > > --001a113d7f74bb768505056d0624--