Hi.
I have such declaration of type
declare Contact
firstName : String
end
then I want to add new property to this type. so the next version is
declare Contact
firstName : String
newField : String
end
this type declaration is in separate drl file.
then I add this new type to current KnowledgeBase.
but when I execute knowledgeBase.getFactType("test.package",
"Contact");
I get old version of Contact.
During debugging I found the place where is should be upgraded in the
KnowledgeBase.
org.drools.common.AbstractRuleBase.mergePackage
there is
// merge the type declarations
if ( newPkg.getTypeDeclarations() != null ) {
// add type declarations
for ( TypeDeclaration type :
newPkg.getTypeDeclarations().values() ) {
// @TODO should we allow overrides? only if the class is not
in use.
if ( !pkg.getTypeDeclarations().containsKey(
type.getTypeName() ) ) {
// add to package list of type declarations
pkg.addTypeDeclaration( type );
}
}
}
so according this comments it's not possible to upgrade Type on the fly.
Am I missing something?
Does someone had such problems or know the workaround.
Thanks in advance,
Yuriy
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Type-Declaration-upgr...
Sent from the Drools - User mailing list archive at
Nabble.com.