Temporal operators fail on persisted SKS
by Melton, Michael P CTR SPAWARSYSCEN-ATLANTIC, 01200
Hello,
I have a SKS that is persisted using JPAKnowledgeService. I am using events and have multiple rules that match on those events using the "after" and "before" temporal operators. When I have a fresh session, I can insert events and fire rules till the cows come home with no issue. However, if I load a persisted session containing event facts and try to insert a new event, when rule conditions attempt to evaluate on the *persisted* events in working memory, I get "org.drools.common.DefaultFactHandle cannot be cast to org.drools.common.EventFactHandle".
I have googled extensively on this issue and, though it seems to be relatively common, none of the resolutions I've seen apply to me. I've doublechecked that my events are declared as such. I've debugged into Drools code and verified that the FactHandle returned upon insertion is an EventFactHandle. However, it seems as if the engine "forgets" that these facts are events when the session is persisted or rehydrated.
I do not currently have a simple example to share, and I can work on one if required, but I wanted to get my question out ahead of that in case anyone in the community has an answer for me off the top of their head. Any assistance is appreciated.
Mike