Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037428Openbravo ERPZ. Otherspublic2017-12-01 07:592017-12-01 08:03
alostale 
Triage Omni OMS 
normalminorhave not tried
newopen 
5
 
 
Core
No
0037428: don't use DalConnectionProvider default constructor
DalConnectionProvider's default constructor is equivalent to new DalConnectionProvider(true) which flushes Hibernate session.

Default constructor shouldn't be used in favor of the more explicit boolean version.

Note that as exposed by 0036638, flush occurs each time that ConnectionProvider acquires a connection which typically when used together with xsql is every time a query is executed.
-
// 1. This version shouldn't be used, does the developer really want a flush or she forgot to use the 
parameterized constructor?
con = new DalConnectionProvider();
...

// 2. This version is better, we're more explicit about flushing
con = new DalConnectionProvider(true); // we need to flush because ...
...


// 3. This version is even better, don't delegate flushes to ConnectionProvider but to them explicitly

con = new DalConnectionProvider(false);
OBDal.getInstance().getSession().flush(); // we need to flush because ...
...
Performance
related to design defect 0036638 new Triage Platform Base DalConnectionProvider(true) or () in combination with standard xsql causes 1 flush per SQL 
Issue History
2017-12-01 07:59alostaleNew Issue
2017-12-01 07:59alostaleAssigned To => Triage Finance
2017-12-01 07:59alostaleModules => Core
2017-12-01 07:59alostaleTriggers an Emergency Pack => No
2017-12-01 08:02alostaleDescription Updatedbug_revision_view_page.php?rev_id=16416#r16416
2017-12-01 08:02alostaleTag Attached: Performance
2017-12-01 08:03alostaleRelationship addedrelated to 0036638
2017-12-01 08:03alostaleIssue Monitored: alostale

There are no notes attached to this issue.