Is it required to use WorkingMemory.update to update an existing fact? I thought if assert behavior was set to equality and you implemented the equals method properly, then you could simply use WorkingMemory.insert to overwrite a fact in working memory with a new version. If this isn't the case, then are there other settings that will give this behavior?
I'm using 4.0.7. Thanks for any help. Eric Here's my RuleBaseConfiguration: AlphaNodeHashingThreshold : 3 CompositeKeyDepth : 3 ExecutorServiceorg.drools.concurrent.DefaultExecutorService RuleBaseUpdateHandler : org.drools.base.FireAllRulesRuleBaseUpdateListener AgendaGroupFactory : [EMAIL PROTECTED] AssertBehaviour : equality ConflictResolver : [EMAIL PROTECTED] ConsequenceExceptionHandler : [EMAIL PROTECTED] LogicalOverride : discard SequentialAgenda : sequential AlphaMemory : false IndexLeftBetaMemory : true IndexRightBetaMemory : true MaintainTms : true RemoveIdenities : true Sequential : false ShadowProxy : true ShareAlphaNodes : true ShareBetaNodes : true UseStaticObjensis : false My TestFact class: public class TestFact { private String id; private String value; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public int hashCode() { return id.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof TestFact)) return false; TestFact other = (TestFact) obj; // not null safe, i know return this.id.equals(other.id); } } And the JUnit Test Case that fails: public void testFactUpdate() throws Exception { TestFact testFact = new TestFact(); testFact.setId("1234"); testFact.setValue("old"); FactHandle testFactHandle = workingMemory.insert(testFact); TestFact updatedFact = new TestFact(); updatedFact.setId("1234"); updatedFact.setValue("new"); FactHandle updatedFactHandle = workingMemory.insert(updatedFact); // using workingMemory.update here works // passes assertTrue(testFactHandle == updatedFactHandle); TestFact retrievedTestFact = (TestFact) workingMemory.getObject(testFactHandle); // fails assertEquals("new", retrievedTestFact.getValue()); } _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users