Question
· Mar 1, 2019

ExentSize and Selectivity for mapped class used from many places

I have a problem,ExtentSize,Selectivity etc is stored in class definition.

I have multiple namespaces with globals maped and only one class definition for All, for example Orders.

Order definition is only one,mapped to main namespace,but in different namespaces have different ExtentSize etc.

Discussion (3)1
Log in or sign up to continue

I suppose you can solve this problem by separating your persistent class into abstract definition and persistent "storage only" class.

It could look like this:

Class test.Abstract.Order [ Abstract ]

{

Property a;

Method doStuff()

{

}

}

and persistent class:

Class test.Order Extends (test.Abstract.Order, %Persistent)

{

/*Generated Storage */

}

And only map test.Abstract package. This way you'll need to:

  • Copy test.Order class manually (but only once, as it does not change).
  • Recompile test.Order class in each namespace if Abstract realization changes.

But in this setup persistent class could be tuned, etc.. Also you can automate deployment steps with CI/CD tools.

Abstract class could have this method:

ClassMethod GetNew() As test.Order {
  set class = "test.Order"
  if ..GetCompileDate($classname())'=..GetCompileDate(class) {
    set sc = $system.OBJ.Compile($classname(),"cukb /display=none")
  }
  quit $classmethod(class, "%New")
}

ClassMethod GetCompileDate(class As %Dictionary.CacheClassname) [CodeMode = expression]
{
$$$comClassKeyGet(class,$$$cCLASStimechanged)
}

IMHO this deserves an enhancement request. Data for mapped lib classes is stored in User Namespaces,  but tune params for this data in Lib Namespace. Looks difficult to use persistent classes as part of a library in this case. 

Maybe you can generate automatically the storage class @Eduard Lebedyuk mentioned with the first call from a User Namespace?