Help Understanding Global Mappings and Sharing One SQL Table Across Multiple Namespaces
I have the class ConfigUtils.ConfigSettingsTable
, which is a persistent object. I know I need to map packages from the original namespace. In this case, I have mapped ConfigUtils.ConfigSettingsTable
from the originating namespace (IRISTST
database) across all other namespaces.
With this, I am able to see the table ConfigUtils.InstanceSettings
in SQL Explorer in each namespace, but the same data is not shared across environments. For example, in the MAINTENANCE
namespace, I can see the table, but I don't see the same information that I see in the table in the original IRISTST
namespace.
I am unclear on the global mappings part of this. What globals should I be looking for? I would appreciate any similar examples of mapping a single SQL table across multiple namespaces.
You need to check the Storage defined in your class, typically automatically generated when the class is first compiled.
For example I have created a ConfigUtils.ConfigSettingsTable class:
Class ConfigUtils.ConfigSettingsTable Extends %Persistent { Property Name As %String; Storage Default { <Data name="ConfigSettingsTableDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>Name</Value> </Value> </Data> <DataLocation>^ConfigUtils.ConfigSetti1ADBD</DataLocation> <DefaultData>ConfigSettingsTableDefaultData</DefaultData> <IdLocation>^ConfigUtils.ConfigSetti1ADBD</IdLocation> <IndexLocation>^ConfigUtils.ConfigSetti1ADBI</IndexLocation> <StreamLocation>^ConfigUtils.ConfigSetti1ADBS</StreamLocation> <Type>%Storage.Persistent</Type> } }
In this case the globals used by my class are:
^ConfigUtils.ConfigSetti1ADBD (Data)
^ConfigUtils.ConfigSetti1ADBI (Indices)
^ConfigUtils.ConfigSetti1ADBS (Streams)
Instead of the 3 single globals, you can map ^ConfigUtils.ConfigSetti1ADB*
Note that you MUST check the actual global(s) name(s) used by your class.
If your class extends another persistent class, then the storage is defined in the superclass that define the extent (the first persistent class in class hierarchy).
Exactly what I needed. Thank you :)
Note that, if needed, you can map your classes and global for ALL namespaces currently defined and defined in the future, please check Mapping to All Namespaces documentation on how to use %ALL namespace mapping.