svn commit: r1497889 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1497889 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

doogie-3
Author: doogie
Date: Fri Jun 28 19:08:09 2013
New Revision: 1497889

URL: http://svn.apache.org/r1497889
Log:
FIX: If using <extend-entity> to change the type of a pre-existing
field, then we need to be certain to remove the existing defined field
from the list of available fields.  Otherwise, you'll end up with the
same field being queried in SELECT, and the same field being updated in
INSERT or UPDATE.

This issue was discovered when changing the type of a pre-existing
field(so that the length of the field could be increased).

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1497889&r1=1497888&r2=1497889&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Fri Jun 28 19:08:09 2013
@@ -356,6 +356,9 @@ public class ModelEntity implements Comp
             }
             // add to the entity as a new field
             synchronized (fieldsLock) {
+                if (existingField != null) {
+                    this.fieldsList.remove(existingField);
+                }
                 this.fieldsList.add(newField);
                 this.fieldsMap.put(newField.getName(), newField);
                 if (!newField.getIsPk()) {