[rules-users] RE:update is not working properly

Darko IVANCAN ivancan at gmx.de
Tue Nov 27 07:24:31 EST 2007


Well rules are executed in an atomic manner, thanks to the agenda.
So, either rule A (retract) or rule B (update) will be executed first.
Both retract and update will trigger a re-evaluation of the facts, thus
other rules will become valid/invalid.

Normally this should not lead to an error, as rule A would simply
invalidate rule B.
Said that, I think it's obvious, that no retract should occur in your
Java code, here: setId.

hope this helps,
Darko Ivancan

P.S.: Do you think you could be able to create a JUnit-Test for that ?


On 27/11/2007 08:21, Mark Proctor wrote:
> a drl can contain both updates and retracts, you should not update(..)
> a retracted facted.
>
> Mark
> Sikkandar Nawabjan wrote:
>> Hi,
>>
>> This exception is not throwing very often. Occasionally i got this FactException . Is it because of another rule/Fact? i have the following rule also
>>
>>  rule "check created error"
>>
>>  dialect "mvel"
>>
>>  salience 100000
>>
>>  no-loop true
>>
>>  when
>>
>>       $add:Address(continent=="asia")
>>
>>  then
>>     retract( $add)
>>  
>>
>> can't a drl file contain both update and retract together? if both rules satisfy the facts  what will happen for the handle?
>>
>>  
>>
>> Thanks and Regs,
>>
>> Basha
>>
>>  
>>
>> Sikkandar Nawabjan wrote:
>>   
>>> Hi,
>>>
>>> I have rule like this
>>>
>>> rule "Update Id"
>>>
>>> dialect "mvel"
>>>
>>> salience 100000
>>>
>>> no-loop true
>>>
>>> when
>>>
>>>      $add:Address(name=="india")
>>>
>>> then
>>>
>>> $add.setId("100");
>>>
>>> update($add)
>>>
>>> end
>>>  
>>>     
>> That should work, its a fairly trivial use case, so I'm very surprised
>> it doesn't.... If you are suare this isn't working for you, can you open
>> a jira  with a minimal self contained test project showing  the error.
>>   
>>> am getting the error org.drools.FactException: Update error: handle not found for object
>>>
>>>     
>>
>>
>>   
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>   
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   



More information about the rules-users mailing list