<div><br></div>   The current version of Drools does not support dynamic changes in &quot;type declarations&quot; and I don&#39;t see this changing anytime soon. The reason is that not only the actual fact would require changes, but the actual knowledge base would require changes as several nodes might be referencing the old class.<div>
<br></div><div>   So, to update a fact type you need to recreate the knowledge base. This is the same, BTW, than changing one of your fact classes in your application jars... you need to recompile the knowledge base or you will end up with class cast exceptions, sooner or later.</div>
<div><br></div><div>    Edson<br><br><div class="gmail_quote">2011/2/14 delete <span dir="ltr">&lt;<a href="mailto:boyun.yuriy@gmail.com">boyun.yuriy@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Hi.<br>
I have such declaration of type<br>
declare Contact<br>
  firstName : String<br>
end<br>
<br>
then I want to add new property to this type. so the  next version is<br>
declare Contact<br>
  firstName : String<br>
  newField : String<br>
end<br>
<br>
this type declaration is in separate drl file.<br>
then I add this new type to current KnowledgeBase.<br>
but when I execute knowledgeBase.getFactType(&quot;test.package&quot;, &quot;Contact&quot;);<br>
I get old version of Contact.<br>
<br>
During debugging I found the place where is should be upgraded in the<br>
KnowledgeBase.<br>
org.drools.common.AbstractRuleBase.mergePackage<br>
there is<br>
// merge the type declarations<br>
        if ( newPkg.getTypeDeclarations() != null ) {<br>
            // add type declarations<br>
            for ( TypeDeclaration type :<br>
newPkg.getTypeDeclarations().values() ) {<br>
                // @TODO should we allow overrides? only if the class is not<br>
in use.<br>
                if ( !pkg.getTypeDeclarations().containsKey(<br>
type.getTypeName() ) ) {<br>
                    // add to package list of type declarations<br>
                    pkg.addTypeDeclaration( type );<br>
                }<br>
            }<br>
        }<br>
<br>
so according this comments it&#39;s not possible to upgrade Type on the fly.<br>
<br>
Am I missing something?<br>
Does someone had such problems or know the workaround.<br>
<br>
Thanks in advance,<br>
Yuriy<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Type-Declaration-upgrade-tp2491975p2491975.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Type-Declaration-upgrade-tp2491975p2491975.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>