Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021360Openbravo ERPA. Platformpublic2012-08-15 16:322012-08-29 16:36
rafademiguel 
mtaal 
normalmajoralways
closedfixed 
5
 
3.0MP15 
marvintm
Core
No
0021360: DalConnectionProvider getTransactionConnection() should be equal than ConnectionProviderImpl getTransactionConnection()
The behaviour of DalConnectionProvider getTransactionConnection() should be equal than ConnectionProviderImpl getTransactionConnection().

Right now ConnectionProviderImpl getTransactionConnection() give a NEW connection and DalConnectionProvider getTransactionConnection() give the connection of the session.
I have some code, is a Process Bundle so the connection provider are get: ProcessBundle.getConnection();

There is a moment that I need to call a method from a class that makes some inserts with XSQL, the class is like this:

public OBError setAttributeInstance(ConnectionProvider conProv,.....)
    conn = conProv.getTransactionConnection();
    ......
    conProv.releaseCommitConnection(conn);
    } catch (Exception e) {
    ....
    conProv.releaseRollbackConnection(conn);
    }

Whatever happens here I don't want rise an exception, I want my flow to continue.

What's the matter?

DalConnectionProvider()

If I use new DalConnectionProvider() when they call getTransactionConnection(); it is giving to me this:

     connection = OBDal.getInstance().getConnection(flush);

so if something goes wrong in my method the rollback affects to the things that happen in my method but also the things I have done before, so breaks my flow

ConnectionProviderImpl(properties)

However, if I use the old implementation ConnectionProviderImpl the getTransactionConnection(); is giving to me this

      /**
       * Gets a new connection without trying to obtain the sessions's one
       */
      private Connection getNewConnection(String poolName) throws NoConnectionAvailableException {....}

So its give a real NEW connection, so when I rollback, only rollback the things done in this conn and doesn't break my entire flow
Modify DalConnectionProvider getTransactionConnection() in order to get a NEW connection.
No tags attached.
related to defect 0037205 closed alostale DB connections leaked executing IssuesTest 
Issue History
2012-08-15 16:32rafademiguelNew Issue
2012-08-15 16:32rafademiguelAssigned To => mtaal
2012-08-15 16:32rafademiguelModules => Core
2012-08-20 22:06hgbotCheckin
2012-08-20 22:06hgbotNote Added: 0051403
2012-08-20 22:06hgbotStatusnew => resolved
2012-08-20 22:06hgbotResolutionopen => fixed
2012-08-20 22:06hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/72e0f315fe574302df9166185cdfca891d418a16 [^]
2012-08-20 22:24mtaalNote Added: 0051409
2012-08-20 22:24mtaalStatusresolved => new
2012-08-20 22:24mtaalResolutionfixed => open
2012-08-20 22:24mtaalClosed by => marvintm
2012-08-20 22:24mtaalStatusnew => scheduled
2012-08-20 22:24mtaalNote Added: 0051410
2012-08-20 22:24mtaalfix_in_branch => pi
2012-08-20 22:25mtaalNote Added: 0051411
2012-08-20 22:25mtaalStatusscheduled => resolved
2012-08-20 22:25mtaalFixed in Version => 3.0MP15
2012-08-20 22:25mtaalResolutionopen => fixed
2012-08-29 16:36marvintmStatusresolved => closed
2017-11-10 09:35caristuRelationship addedrelated to 0037205

Notes
(0051403)
hgbot   
2012-08-20 22:06   
Repository: erp/devel/pi
Changeset: 72e0f315fe574302df9166185cdfca891d418a16
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Aug 20 18:26:36 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/72e0f315fe574302df9166185cdfca891d418a16 [^]

Fixes issue 21360: DalConnectionProvider getTransactionConnection() should be equal than ConnectionProviderImpl
Use a statelesssession to create a new connection

---
M src-test/org/openbravo/test/dal/IssuesTest.java
M src/org/openbravo/service/db/DalConnectionProvider.java
---
(0051409)
mtaal   
2012-08-20 22:24   
Set closed by
(0051410)
mtaal   
2012-08-20 22:24   
.
(0051411)
mtaal   
2012-08-20 22:25   
Resolved