[rules-users] equality-based assert behavior and findFactHandle

Adam Lewandowski adam at alewando.com
Mon Oct 29 13:32:14 EDT 2007


If I set my rule base to use equality-based assert behavior, I'm 
expecting to be able to use the getFactHandle(object) method to retrieve 
a previously asserted fact by providing an equivalent (by equals() and 
hashCode()) object as an argument. This appears to not be the case, as 
AbstractWorkingMemory uses it's identityMap and associated 
IdentityAssertMapComparator to do the getFactHandle lookup instead of 
the assertMap and EqualityAssertMapComparator. This causes the lookup to 
be done with the system hashCode() method and not the overridden version 
supplied in my fact class. The lookup thus fails and returns null.

Is there a way to have getFactHandle or some equivalent code do what I 
want? This is with 4.0.3.

Thanks,
Adam Lewandowski



More information about the rules-users mailing list