You can 'disable' this by *explicitly* specifying not to assign the same object like this:
$n : new_item : Item( exId : externalId )
old_item : Item( this != $n, externalId == exId )

this relies on equals/hashCode method, if you need to use object identities:
$n : new_item : Item( exId : externalId )
$o : old_item : Item( eval($o != $n), externalId == exId )


On Thu, Nov 13, 2008 at 3:19 AM, Knych, Thomas <thomas.knych@citi.com> wrote:
Hi -

I'm upgrading a large base of rules from 3.x to 4.0.7. However there
seem to be a few semantic differences. I have rules like the below in a
few places:

rule "All items should have a unique external id"
     when
               new_item : Item( exId : externalId )
                   old_item : Item( externalId == exId )
       then
               LOG.warn( "DUPE Detected: new:" +  new_item + " old:" +
old_item );
               retract( new_item );
end

And this all worked fine because 3.x would never assign the same object
to both new_item and old_item. I know my new/old seem arbitary - but I'm
just getting down to the minimal reproducing case. 4.x now will assign
one instance of an object to both new_item and old_item. Is there any
way to disable this behaviour?


thanks,
-Tom

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users