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 9E7DD10E3F for ; Tue, 11 Mar 2014 18:01:29 +0000 (UTC) Received: (qmail 94589 invoked by uid 500); 11 Mar 2014 18:01:28 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 94044 invoked by uid 500); 11 Mar 2014 18:01:23 -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 94029 invoked by uid 99); 11 Mar 2014 18:01:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 18:01:21 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [196.25.240.215] (HELO rrba-ip-smtp-3-5.saix.net) (196.25.240.215) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 18:01:12 +0000 Received: from IV5 (ti-225-248-196.telkomadsl.co.za [105.225.248.196]) by rrba-ip-smtp-3-5.saix.net (Postfix) with SMTP id CB173419 for ; Tue, 11 Mar 2014 20:00:46 +0200 (SAST) Message-ID: <4E6868399D5D4873AFC3CFF0EC1C3088@IV5> From: To: References: <6727.41.79.37.229.1394545727.squirrel@webmail.xsinet.co.za> <531F1D4E.6030309@smasolutions.it> In-Reply-To: <531F1D4E.6030309@smasolutions.it> Subject: Re: Setting the Transaction Isolation Level Date: Tue, 11 Mar 2014 20:00:46 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3522.110 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3522.110 X-Virus-Checked: Checked by ClamAV on apache.org Thanks Laurent I understand the MyPoolManager class but I'm not sure about how to use it as you demonstrated. I am using 3.1 though and have a static method: public static DataContext getContext() { if ( server == null ) { String iniFile = .....; MyDataSourceModule module = new MyDataSourceModule( iniFile ); server = new ServerRuntime( "cayenne-Vision.xml", module ); } return (DataContext) server.getContext(); } So how do I further configure ServerRuntime to accommodate MyPoolManager ? Thanks, Jurgen -----Original Message----- From: Laurent Marchal Sent: Tuesday, March 11, 2014 4:27 PM To: user@cayenne.apache.org Subject: Re: Setting the Transaction Isolation Level Hi Jurgen, In Cayenne 3.0 I achieved this by extending PoolManager with my own class and override the newPooledConnection() method. I don't know about Cayenne 3.1 Class MyPoolManager : @Override protected PooledConnection newPooledConnection(String userName, String password) throws SQLException { // override superclass to call stored procedure final PooledConnection pConn = super.newPooledConnection(userName, password); Connection connection = pConn.getConnection(); connection.setAutoCommit(false); // disable auto commit connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); // avoid deadlock on big SELECTs return pConn; } To use MyPoolManager do : DataDomain domain = _conf.getDomain(); DataNode node = domain.getNode(CAYENNE_DATANODE); try { ConnectionPoolDataSource dataSource = getDataSourceFromConfig(config); OpconPoolManager poolManager = new MyPoolManager(_listenerList, dataSource, config.getDatabaseUser(), config.getDatabasePassword(), user); node.setDataSource(poolManager); return poolManager; } catch (SQLException e) { throw new MyException("Cannot create database connection pool, bad database configuration: " + config.getDataSourceUrl(), e); } Hope this helps, Laurent. On 3/11/14, 8:48 AM, dollj@xsinet.co.za wrote: > Hi All > > I'm using jTDS to connect to a MS SQL db, their default setting for > transaction isolation is READ_COMMITED which I would like to change. > > jTDS doesn't seem to have a property that can be sent via the connection > URL so that means that I need to change it through Cayenne. > > So can anyone show me how one changes the default transaction isolation > level ? > > Thanks > Jurgen > >