Hi.
We were having a problem with creating entities (example Party, Facility or Product) wherein whenever we provide an id for a new entity during creation and that id exists, ofbiz updates the entity of the given id instead of throwing an exception. We checked the schema of simple-methods and saw that the attribute "or-store" for the element "create-value" can be set to false if you don't want this behavior. Seeing that most simple methods of ofbiz for creating entities does not specify a value for the attribute "or-store", that attribute should have a value of "false"; that is, it should not update the entity of the given id if its already existing. We checked the class org.ofbiz.minilang.method.entityops.CreateValue and saw that the condition for checking the attribute "or-store" was wrong. snippet of http://svn.apache.org/repos/asf/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.javarev 791212 *76* if (createOrStore = true) { *77* methodContext.getDelegator().createOrStore(value, doCacheClear); *78* } else { *79* methodContext.getDelegator().create(value, doCacheClear); *80* } ** lines 75 - 79 for http://svn.apache.org/repos/asf/ofbiz/branches/release09.04/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.javarev 759238 As you can see, the if condition at line 75 would always result to true; therefore, would always use Delegator#createOrStore(GenericValue, boolean). Thanks. ian |
Thanks Ian. This is fixed in SVN rev 792422. -David On Jul 9, 2009, at 12:10 AM, ian tabangay wrote: > Hi. > We were having a problem with creating entities (example Party, > Facility or > Product) wherein whenever we provide an id for a new entity during > creation > and that id exists, ofbiz updates the entity of the given id instead > of > throwing an exception. We checked the schema of simple-methods and > saw that > the attribute "or-store" for the element "create-value" can be set > to false > if you don't want this behavior. Seeing that most simple methods of > ofbiz > for creating entities does not specify a value for the attribute "or- > store", > that attribute should have a value of "false"; that is, it should > not update > the entity of the given id if its already existing. We checked the > class > org.ofbiz.minilang.method.entityops.CreateValue and saw that the > condition > for checking the attribute "or-store" was wrong. > > snippet of > http://svn.apache.org/repos/asf/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.javarev > 791212 > > *76* if (createOrStore = true) { > > > *77* methodContext.getDelegator().createOrStore(value, > doCacheClear); > *78* } else { > *79* methodContext.getDelegator().create(value, > doCacheClear); > *80* } > > ** lines 75 - 79 for > http://svn.apache.org/repos/asf/ofbiz/branches/release09.04/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.javarev > 759238 > > As you can see, the if condition at line 75 would always result to > true; > therefore, would always use Delegator#createOrStore(GenericValue, > boolean). > > > Thanks. > ian |
Found it. Thanks for the quick response.
ian On Thu, Jul 9, 2009 at 2:50 PM, David E Jones <[hidden email]> wrote: > > Thanks Ian. This is fixed in SVN rev 792422. > > -David |
Free forum by Nabble | Edit this page |