[rules-users] Persistence of events

Maciej Prochniak mpr at touk.pl
Tue Oct 6 05:08:52 EDT 2009


Hello,

Is it possible to persist events (from drools fusion) with default jpa
mechanism? When I try to do this 'just like that' I get exception 
like 
org.drools.common.DefaultFactHandle incompatible with
org.drools.common.EventFactHandle 
It seems that session marshaller is not really aware of certain objects
being events, not facts.

The code I try is more or less like:

UserTransaction ut = ...

StatefulKnowledgeSession session = JPAKnowledgeService
				.newStatefulKnowledgeSession(kbase, null, env);
ut.begin()
session.insert(e1);
ut.commit();

StatefulKnowledgeSession sessionPersisted = 
JPAKnowledgeService.loadStatefulKnowledgeSession( session.getId(),
kbase, null, env );

ut.begin()
sessionPersisted.insert(e2); (*) <- fails
ut.commit();

When I use session instead of sessionPersisted - it works fine, when 
e2 is a fact, not an event - it also works

I know that it may be awkward to persist events which have time
limitations, but I want to use time limits in rules which are like few
days - so I want to have some persistence in case of server shutdown.


I would be grateful for any comment,


br, 
maciek prochniak




More information about the rules-users mailing list