Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0009780Openbravo ERPA. Platformpublic2009-07-06 17:532009-07-27 00:00
mtaal 
mtaal 
normalmajoralways
closedfixed 
5
pi 
pi2.50MP3 
Core
No
0009780: Module which add system level information (e.g. ad_ref_list) and add system reference data can not be (un)installed
This is a description based on the installation of the hcm module (attached). The general problem is that the apply.modules action when initiated from the web interface runs in the same jvm (classloader) as the webapp. I will first describe two specific things with this module:
1) it adds a new treetype and adds system level data which uses this tree type
2) it adds a column to a core table (BusinessPartnerBankAccount)

1) results in a fail during install, when trying to solve 1) --> 2) results in a fail during an uninstall.

>> Why does 1) fail
First the basic apply.modules process:
A) update.database
B) apply.module (incl. import of system level reference data)

After step A the database has the new model definition (with the new tree-type). However as the in-memory model is not refreshed step B fails as in step B the new tree type is used by imported System level data.

Initial solution idea (which does not work because then the uninstall fails): re-initialize the in-memory model after update.database

>> Why does 2) fail when we solve 1)
In this case the same steps A and B are executed. The module adds a column to BusinessPartnerBankAccount. So during an uninstall after step A, the column is removed from AD_COLUMN. To solve 1), after step A the in-memory model is refreshed. However, the generated classes still have this column, so during the re-initialization of the model the generated class (based on the old model before the uninstall) is encountered and it fails because it sets a default value for a column which does not exist.

Initial solution idea for this case: regenerate the entity classes after re-initializing the model. So then the steps would be:
A) update.database
B) re-initialize in-memory model
C) regenerate entity classes
D) apply.module

However, this flow does not work because the same jvm/classloader is used for all steps (and the webapp as a whole), so eventhough the class files are regenerated and compiled the jvm/classloader will still have the old classes in-memory.

So to really solve this the apply.module step in the install and uninstall of a module from the web interface should be running in its own jvm (forked).
250MP3releasecandidate
related to defect 0009822 closed mtaal API check: build 69 fails 
? org.openbravo.hcm.common-1.0.0.obx (221,192) 2009-07-06 17:53
https://issues.openbravo.com/file_download.php?file_id=1517&type=bug
Issue History
2009-07-06 17:53mtaalNew Issue
2009-07-06 17:53mtaalAssigned To => mtaal
2009-07-06 17:53mtaalFile Added: org.openbravo.hcm.common-1.0.0.obx
2009-07-06 23:27hgbotCheckin
2009-07-06 23:27hgbotNote Added: 0017947
2009-07-06 23:27hgbotStatusnew => resolved
2009-07-06 23:27hgbotResolutionopen => fixed
2009-07-06 23:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d3aa261a64fc0882c8e4f2026ad707e2952ae9fc [^]
2009-07-09 16:43AinhoaPagolaNote Added: 0018063
2009-07-10 10:24shuehnerRelationship addedrelated to 0009822
2009-07-21 16:24psarobeFixed in Version => 2.50MP3
2009-07-21 16:26psarobeTag Attached: 250MP3releasecandidate
2009-07-26 22:05psarobeStatusresolved => closed
2009-07-26 22:05psarobeNote Added: 0018623
2009-07-27 00:00anonymoussf_bug_id0 => 2827493

Notes
(0017947)
hgbot   
2009-07-06 23:27   
Repository: erp/devel/pi
Changeset: d3aa261a64fc0882c8e4f2026ad707e2952ae9fc
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Jul 06 23:26:21 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d3aa261a64fc0882c8e4f2026ad707e2952ae9fc [^]

fixes issue 9780: Module which adds system level information (e.g. ad_ref_list) and add system reference data can not be (un)installed

---
M build.xml
M src/build.xml
M src/org/openbravo/erpCommon/modules/ApplyModuleTask.java
---
(0018063)
AinhoaPagola   
2009-07-09 16:43   
I have tested the fix using HCM module and it is working fine. Thanks!
(0018623)
psarobe   
2009-07-26 22:05   
Thanks Ainhoa