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 6D2EB10208 for ; Tue, 11 Mar 2014 18:48:59 +0000 (UTC) Received: (qmail 95073 invoked by uid 500); 11 Mar 2014 18:48:33 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 94735 invoked by uid 500); 11 Mar 2014 18:48:19 -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 94572 invoked by uid 99); 11 Mar 2014 18:48:12 -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:48:11 +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.197] (HELO rrba-ip-smtp-6-1.saix.net) (196.25.240.197) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 18:48:05 +0000 Received: from IV5 (ti-225-248-196.telkomadsl.co.za [105.225.248.196]) by rrba-ip-smtp-6-1.saix.net (Postfix) with SMTP id CA5871D30 for ; Tue, 11 Mar 2014 20:47:40 +0200 (SAST) Message-ID: <7F45E030088F4D34A3FA36D598D9B65C@IV5> From: To: References: <6727.41.79.37.229.1394545727.squirrel@webmail.xsinet.co.za> <531F1D4E.6030309@smasolutions.it> <4E6868399D5D4873AFC3CFF0EC1C3088@IV5> In-Reply-To: Subject: Re: Setting the Transaction Isolation Level Date: Tue, 11 Mar 2014 20:47:40 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original 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 Hi Mike Thanks for your input, I had a look and found that I can specify a DBCPDataSourceFactory in the modeler. Found some info on that here http://cayenne.apache.org/docs/3.0/dbcpdatasourcefactory.html In short DBCPDataSourceFactory uses a properties file specified in the modeler that can contain various DataSource properties, connection pool properties and prepared statement pool properties. I'll give it a try and see what happens. Thanks again, regards Jurgen -----Original Message----- From: Mike Kienenberger Sent: Tuesday, March 11, 2014 8:06 PM To: user@cayenne.apache.org Subject: Re: Setting the Transaction Isolation Level For what it's worth, I configure my pool manager in Cayenne 3.1 via a factory in the cayenne.xml file: wrote: > 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 >> >> >