[rules-users] AddKnowledgePackage with rules that uses global vars complains that the global var is not set

Edson Tirelli tirelli at post.com
Fri Jun 11 14:53:31 EDT 2010


   Esteban,

   That is not correct. Drools allows for dynamic addition/removal of assets
and properly update existing sessions to reflect that.

   As I explained in the IRC:

<etirelli> dranelf: the problem is not "firing" the rules, but the fact that
the LHS of the rules is evaluated immediatelly after they are added to the
kbase
<etirelli> dranelf: you will need to define and set your global before
loading those rules
<etirelli> just use a separate DRL file that may contain only the global
definition
<etirelli> load it, set the global and then after that load the actual rules

   Edson


2010/6/11 Esteban Aliverti <esteban.aliverti at gmail.com>

> I think that if you modify the kbase, you must recreate all your sessions.
> You can't use any session created previous the kbase modification.
>
> Best,
>
>
> On Fri, Jun 11, 2010 at 3:32 PM, dgimenes <dranelf at gmail.com> wrote:
>
>>
>> I'm trying to add rules after the Process (workflow) started. That works,
>> but
>> I wanted the rules to access database data using hibernate.
>>
>> So I created a global object to store my EntityManager (I'm using SEAM;
>> it's
>> like a Session object).
>>
>> The problem is that when I add the KnowledgePackage with the rule that
>> uses
>> the EntityManager, an exception is thrown because the global is not set.
>> BUT, if I try to set the global var, I get an exception saying it does not
>> exist.
>>
>> Do you have any idea?
>>
>> I've seen that when I add the KnowledgePackage to the
>> StatefullKnowledgeSession the rules are fired, and then I get the
>> exception.
>> Is there a way to NOT fire the rules after inserting the packages?
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/AddKnowledgePackage-with-rules-that-uses-global-vars-complains-that-the-global-var-is-not-set-tp889311p889311.html
>> Sent from the Drools - User mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100611/e6009e17/attachment.html 


More information about the rules-users mailing list