Looks like there's a JIRA for this now. Some feedback would have been
nice, however.
http://jira.jboss.com/jira/browse/JBRULES-1649
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Fenderbosch,
Eric
Sent: Monday, June 16, 2008 11:00 AM
To: Rules Users List
Subject: RE: [rules-users] QueryResult.getFactHandles bug?
Any feedback on this? Just curious, we've worked around it, but I'd
like to know if my assumption was wrong or if this is an actual problem.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Fenderbosch,
Eric
Sent: Monday, June 09, 2008 11:39 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] QueryResult.getFactHandles bug?
I didn't find a JIRA for this and I'm pretty sure my test is valid.
QueryResult.getFactHandles() seems to be only returning [fid:-1:X:null]
I'm using 4.0.7.
Here's my test case:
public void testQueryResults() throws Exception {
StatefulSession workingMemory = DroolsUtil.getWorkingMemory();
TestFact testFact = new TestFact();
String id = "1234";
testFact.setId(id);
FactHandle testHandle = workingMemory.insert(testFact);
System.out.println(testHandle);
Object[] args = {id};
int resultCount = 0;
int factCount = 0;
int handleCount = 0;
Object fact = null;
FactHandle handle = null;
// query getTestFact(String _id)
// TestFact(id == _id)
// end
QueryResults queryResults =
workingMemory.getQueryResults("getTestFact", args);
Iterator<QueryResult> iterator = queryResults.iterator();
while (iterator.hasNext()) {
resultCount++;
QueryResult result = iterator.next();
FactHandle[] handles = result.getFactHandles();
for (FactHandle h : handles) {
handleCount++;
handle = h;
}
for (int i = 0; i < result.size(); i++) {
factCount++;
fact = result.get(i);
}
}
System.out.println(handle);
assertTrue(resultCount == 1);
assertTrue(factCount == 1);
assertTrue(testFact == fact);
assertTrue(handleCount == 1);
// this fails
assertTrue(testHandle == handle);
}
TestFact is very simple, using id in hashCode and equals.
Am I using getFactHandles correctly?
Thanks.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users