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, do...@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



Reply via email to