I'm converting from 4.0.7 to 5.0.1 and am getting errors on the previously working function below, (note this function is in the drl file):<br><br>The error is:<br>"Type mismacth: cannot convert from org.drools.QueryResults to org.drools.runtime.rule.QueryResults"<br>
<br><br>I'm told we need to use the following class for queries in 5.0 and going forward:<br><br>import org.drools.runtime.rule.QueryResults;<br>import org.drools.runtime.rule.QueryResultsRow;<br><br><br>The problem is getting a pointer to working memory from within a rule or function used to be done via the KnowledgerHelper object but that is not compatible with the new QueryResults class.<br>
<br>What am I doing wrong?<br><br><br>-------------------------------------------------------------------------------------------------------------------------------<br><br>function CardTransaction getCompletedTransaction (String cardnum, KnowledgeHelper khObj) {<br>
CardTransaction tranObj = null;<br> String[] queryParams = {cardnum}; <br><br> QueryResult result = null;<br><br> final QueryResults results = khObj.getWorkingMemory().getQueryResults("GetCompletedTransaction", queryParams);<br>
<br> for (Iterator<QueryResult> it = results.iterator(); it.hasNext(); ) {<br> result = it.next();<br> tranObj = (CardTransaction)result.get("cardtransactionobj");<br> }<br> <br>
if (tranObj != null)<br> return tranObj;<br> else <br> return null;<br>}<br><br><br><br clear="all">Scott<br><br><br>