Bug on creating an entity thru minilang

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

Bug on creating an entity thru minilang

ian tabangay
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
Reply | Threaded
Open this post in threaded view
|

Re: Bug on creating an entity thru minilang

David E. Jones-2

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

Reply | Threaded
Open this post in threaded view
|

Re: Bug on creating an entity thru minilang

ian tabangay
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