I did some quick experiments with 5.6.0-SNAPSHOT and a local jUnit test (no
Spring and no Guvnor).
I'm also trusting the logs to detect DB activity, so tak e
dunnlow wrote*
(1)
*
Note, when I create the new ksesison as above in bold, the new
session is
created in the database, and the kagent sees the changes in Guvnor
(although, interestingly when I build vs when I deploy); however, the
persisted session in the database is not updated.
*
(2)
*
If I try
ksession=kAgent.getKnowledgeBase().newStatefulKnowledgeSession(null,env)
the new session is NEVER created in the database.
The JPA persistent session is a wrapper for a normal internal session. It
uses commands to intercept WM actions and update the persisted session in
the DB.
So, if you create the session directly from the KAgent's KB, it will not
even see the JPA layer, so (2) won't work.
(1) with the KAgent's newInstance set to false, will update the in-memory
knowledge base and the internal session. The JPA session, however, won't see
the change, so no DB interaction will happen
until you, say, fire all rules (or invoke any other command-dispatching
method through the JPA session)
dunnlow wrote*
(3)
*
If a session already exists, the loadStatefulKnowledgeSession does
read
the existing session, and the kagent triggers on a build in guvnor, but
the session is not updated :(
When I read the session, I can see a DB update. More updates follow when you
invoke actions on the
newly restored session.
First of all, I'd check the behaviour outside of your container.. what you
are seeing may be due to
some persistence bug that was fixed after 5.5 was released. If not, we'll
have to understand what
happens inside Spring
Best
Davide
--
View this message in context:
http://drools.46999.n3.nabble.com/KnowledgeAgent-with-persistence-tp40258...
Sent from the Drools: User forum mailing list archive at
Nabble.com.