Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0011886Openbravo ERPA. Platformpublic2009-12-31 13:102010-01-19 01:41
plujan 
mtaal 
immediatecriticalhave not tried
closedfixed 
5
2.50MP10 
2.50MP10 
Core
No
0011886: When updating from mp8 to mp10 having spanish pack pro installed, I get an exception
While rebuilding after updating an mp8 with spanish pack pro, I got this error:

[java] Generating entities...
[java] Dataset DS updated succesfully. Reinitializing DAL
[java] Initializing in-memory model...
[java] Building runtime model
[java] Model read in-memory, generating mapping...
[java] Property leaseBusiness not defined for entity Product
[java] org.hibernate.InstantiationException: could not instantiate test objectorg.openbravo.model.common.plm.Product
[java] at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:25)
[java] at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44)
[java] at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
[java] at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
[java] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
[java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
[java] at org.openbravo.base.session.SessionFactoryController.initialize(SessionFactoryController.java:150)
[java] at org.openbravo.dal.core.DalLayerInitializer.initialize(DalLayerInitializer.java:78)
[java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.doExecute(AlterDatabaseDataAll.java:195)
[java] at org.openbravo.dal.core.DalInitializingTask.execute(DalInitializingTask.java:116)
[java] at org.openbravo.ddlutils.task.BaseDalInitializingTask.execute(BaseDalInitializingTask.java:88)
[java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.execute(AlterDatabaseDataAll.java:94)
[java] at org.openbravo.ddlutils.task.AlterDatabaseJava.main(AlterDatabaseJava.java:43)
[java] Caused by: java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[java] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[java] at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:22)
[java] ... 15 more
[java] Caused by: org.openbravo.base.exception.OBException: Property leaseBusiness not defined for entity Product
[java] at org.openbravo.base.model.Entity.checkValidPropertyAndValue(Entity.java:360)
[java] at org.openbravo.base.structure.BaseOBObject.setDefaultValue(BaseOBObject.java:71)
[java] at org.openbravo.model.common.plm.Product.<init>(Product.java:194)
[java] ... 20 more
1. Use an Openbravo mp8 with spanish localization pack pro v1.1 installed
2. Check for updates in order to get both mp10 and the 1.2 version of the pack
3. Install updates and rebuild
4. You will see the above error

Additional note: This will not happen when starting from mp9.
No tags attached.
related to defect 0011556 closed mtaal ValidationException when updating from MP8 to MP9 
Issue History
2009-12-31 13:10plujanNew Issue
2009-12-31 13:10plujanAssigned To => marvintm
2010-01-04 12:15iciordiaAssigned Tomarvintm => mtaal
2010-01-04 12:16iciordiaStatusnew => scheduled
2010-01-04 12:16iciordiaNote Added: 0023190
2010-01-04 12:16iciordiafix_in_branch => pi
2010-01-04 12:33mtaalNote Added: 0023191
2010-01-08 19:19hgbotCheckin
2010-01-08 19:19hgbotNote Added: 0023275
2010-01-08 19:19hgbotStatusscheduled => resolved
2010-01-08 19:19hgbotResolutionopen => fixed
2010-01-08 19:19hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/480b6bd9f54f095eb11339ef1e3a4b6284bf6ca2 [^]
2010-01-14 10:30plujanNote Added: 0023404
2010-01-14 10:30plujanStatusresolved => closed
2010-01-15 00:00anonymoussf_bug_id0 => 2932416
2010-01-19 01:41hudsonbotCheckin
2010-01-19 01:41hudsonbotNote Added: 0023537
2010-01-19 20:29mtaalRelationship addedrelated to 0011556

Notes
(0023190)
iciordia   
2010-01-04 12:16   
Martin,

please review this issue, this is a stopper for MP10.

Thanks,

Ismael
(0023191)
mtaal   
2010-01-04 12:33   
Hi Ismael,
Afaics this is caused because update.database does not reload the classes, so the old entity class is still in memory.
In this case a column was removed from a table. The update.database rereads the model from the database, so the model does not contain the property anymore. However, because the class is not reloaded the class still has a default value call for this property.

In mp9 the setting of default values has been made more robust so it won't fail on this. However, the update.database in this step apparently still uses the old class not having this fix.

The real solution imo is that update.database should reload the classes after it has done the update of the database.

Antonio is not back until thursday, so I will take a look.

gr. Martin
(0023275)
hgbot   
2010-01-08 19:19   
Repository: erp/devel/pi
Changeset: 480b6bd9f54f095eb11339ef1e3a4b6284bf6ca2
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri Jan 08 19:19:01 2010 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/480b6bd9f54f095eb11339ef1e3a4b6284bf6ca2 [^]

Fixed issue 11886. Fixed issue 11910. Primary Keys will not be recreated twice if there is more than one module which modifies the same table.

---
M src-db/database/build.xml
M src-db/database/lib/dbsourcemanager.jar
---
(0023404)
plujan   
2010-01-14 10:30   
Tested in 2.50.15806
(0023537)
hudsonbot   
2010-01-19 01:41   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/480b6bd9f54f [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/7f3a35240cf9 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/obx/core/OpenbravoERP-2.50CI.15846.obx [^]