Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0024495Openbravo ERPA. Platformpublic2013-08-07 09:352013-08-09 08:45
alostale 
alostale 
immediatecriticalN/A
closedfixed 
5
 
3.0MP27 
Core
No
0024495: Lazy computed columns API chage
Fix for issue 0024104 makes computed columns to be lazily calculated. As part of this fix, generated code for DAL entities has renamed properties for computed columns in order to prevent accidental filtering by them which would cause performance issues.

NOTE: Computed columns cannot be used as part of Criterias anymore.

The properties for computed columns present in core that have been removed are (see http://builds.openbravo.com/view/try/job/try-api/1527/console [^]):

org.openbravo.model.common.order:
Missing
field org.openbravo.model.common.order.Order.PROPERTY_DELIVERYSTATUS: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.common.order.Order.PROPERTY_INVOICESTATUS: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527

org.openbravo.model.financialmgmt.calendar:
Missing
field org.openbravo.model.financialmgmt.calendar.Period.PROPERTY_STATUS: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527

org.openbravo.model.financialmgmt.payment:
Missing
field org.openbravo.model.financialmgmt.payment.DoubtfulDebt.PROPERTY_OUTSTANDINGDOUBTFULDEBTAMOUNT: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount.PROPERTY_LASTRECONBALANCE: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount.PROPERTY_LASTRECONCILIATION: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_PaymentProposal.PROPERTY_LIMITWRITEOFF: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_PaymentSchedule.PROPERTY_DAYSOVERDUE: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_PaymentSchedule.PROPERTY_LASTPAYMENTDATE: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_PaymentSchedule.PROPERTY_NUMBEROFPAYMENTS: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
field org.openbravo.model.financialmgmt.payment.FIN_PaymentSchedule.PROPERTY_TOTALDEBTAMOUNT: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527

org.openbravo.model.manufacturing.transaction:
Missing
field org.openbravo.model.manufacturing.transaction.WorkRequirement.PROPERTY_CLOSEDSTAT: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527

org.openbravo.model.materialmgmt.transaction:
Missing
field org.openbravo.model.materialmgmt.transaction.ShipmentInOut.PROPERTY_INVOICESTATUS: missing in /srv/hudson/workspace/try-full-oracle/SANDBOX/api-checks/output/1527
+ failure=1

It also changes the way computed columns can be queried using HQL.

In case computed columns are needed to be accessed from HQL, they are not directly available but through the _computedColumns property. As example, this HQL:
  from Order o where o.deliveredStatus = 100
should be rewritten to:
  from Order o where o._computedColumns.deliveredStatus = 100

Note this kind of queries should be reviewed not only because of the API change but also because they can cause performance problems.


The naming of computed columns properties in generated code code be preserved to the old one not making an API change, but this is not the case for HQL. Also code making use of these proeprties should be reviewed because it is potentially harmful in terms of performance. This is the reason this API change in the generated code has been intentionally introduced.
-
Even the risk of this API change is potentially high, the proposal is to accept it because it is intended to improve performance.
No tags attached.
depends on design defect 00241043.0MP27 closed alostale Openbravo ERP Unnecessary evaluation of computed columns 
related to defect 0024516RMP26 closed guilleaer Retail Modules WebPOS relies on delivery status to check if a ticket is a layaway 
related to defect 0026412 closed alostale Openbravo ERP Property fields based on computed columns with a FK fail 
Issue History
2013-08-07 09:35alostaleNew Issue
2013-08-07 09:35alostaleAssigned To => dmitry_mezentsev
2013-08-07 09:35alostaleModules => Core
2013-08-07 09:35alostaleTriggers an Emergency Pack => No
2013-08-07 09:42alostaleProposed Solution updated
2013-08-07 09:42alostaleRelationship addeddepends on 0024104
2013-08-07 14:27alostaleDescription Updatedbug_revision_view_page.php?rev_id=4944#r4944
2013-08-08 17:41dmitry_mezentsevNote Added: 0060547
2013-08-08 17:41dmitry_mezentsevAssigned Todmitry_mezentsev => alostale
2013-08-08 17:46alostaleRelationship addedrelated to 0024516
2013-08-09 08:35hgbotCheckin
2013-08-09 08:35hgbotNote Added: 0060549
2013-08-09 08:35hgbotStatusnew => resolved
2013-08-09 08:35hgbotResolutionopen => fixed
2013-08-09 08:35hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/api-checks/rev/f9a212cc9d224d817a376cb8dd1fd3247b6501c4 [^]
2013-08-09 08:45alostaleNote Added: 0060550
2013-08-09 08:45alostaleStatusresolved => closed
2013-08-09 08:45alostaleFixed in Version => 3.0MP27
2014-04-29 11:47caristuRelationship addedrelated to 0026412

Notes
(0060547)
dmitry_mezentsev   
2013-08-08 17:41   
Accepted.

The change is risky but the impact should be low as in Openbravo distribution we did not find any above mentioned use of calculated fields. There is one use-case in Retail which is wrong anyway.
(0060549)
hgbot   
2013-08-09 08:35   
Repository: erp/devel/api-checks
Changeset: f9a212cc9d224d817a376cb8dd1fd3247b6501c4
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Aug 09 08:34:51 2013 +0200
URL: http://code.openbravo.com/erp/devel/api-checks/rev/f9a212cc9d224d817a376cb8dd1fd3247b6501c4 [^]

fixed issue 24495: Lazy computed columns API chage

---
M java/reference/java.japi.gz
---
(0060550)
alostale   
2013-08-09 08:45   
see documentation: http://wiki.openbravo.com/wiki/How_to_create_a_Computed_Column#Limitations [^]