Posted: 22 Feb 2018 5:35 EST Last activity: 4 Sep 2018 13:26 EDT
External Database table mapping
We have class structure as mentioned below:
These classes i.e. Class1, Class2 and Class3 are mapped to external database tables Table1, Table2 and Table3 respectively. These tables are identical i.e only table name changed.
I used Connector and Metadata wizard to generate mapping classes and properties. As tables are identical, wizard created same properties in all mapping classes.
For reusability, I want to move these properties to Parent Class (i.e. Abstract class Org-Div-Data-External) and create other mapping classes manually (to avoid creation and deletion of property). So that same properties can be utilized across all mapping classes. But come to know that, external class does not support inheritance and rule resolution. What does it exactly mean?
External mapping wizard automatically creates class and properties for externally mapped table internally in Pega application for convenience and to avoid the error.
No inheritance or rule resolution applies to external classes, even if the class name contains a dash character. Each external class has an associated database table instance (Data-Admin-DB-Table class) and so cannot be part of a class group.
To answer your question,
An external class is a concrete class (an instance of the Rule-Obj-Class rule type) that corresponds to a table in an external relational database, rather than to a table or view in the PegaRULES database.
You can create an external class and associated properties by using the Connector and Metadata accelerator or the New External Database Table Class Mapping button on the Data Model Classes and Properties landing page. Reference
Thanks for reply but still I am in confusion. Please explain it in more detail, if possible an example will be helpful.
From Scenario mentioned in my question:
Lets assume I have created properties Column1 and Column2 inside Org-Div-Data-External (Abstract Class). I am able to use these properties inside child class i.e. Org-Div-Data-External-Class1 (mapped to external database table).
As we know and you also said No inheritance or rule resolution applies to external classes, even if the class name contains a dash character.
So, my question is, if No inheritance or rule resolution applies to external classes, how I am able to utilize properties Column1 and Column2 in child class (i.e. Org-Div-Data-External-Class1)?
You can go through this discussion where the inheritance has been achieved for the external classes.
Similarly, you can create the common properties in Org-Div-Data-External class using external class mapping wizard.
Now you can create the Org-Div-Data-External-Class1 class with the specific properties of this class and try to inherit the common properties from the parent External class as explained in the above discussion.
Hope this approach might help you to achieve your requirement.
I have create the properties inside Org-Div-Data-External (Abstract class) and utilizing it in all external classes (Org-Div-Data-External-Class1 ). This is working fine for me. Thanks for providing the reference link.
I want to know, why Pega is saying that No inheritance and rule resolution is applicable for external classes? Am I missing/misunderstood something?
I am not sure about "No inheritance and rule resolution is applicable for external classes?" statement regarding the external classes where it has been specified and why. I will try to check with some product specialists and let you know if i get their feedback on it.
The note about rule resolution is specific to Class Groups. When you define an external class, The class cannot be a part of a class group. The class must be concrete and all instances in the external class will be stored in the defined external class. Where you can define "sub" classes that roll up to a class group. An example would be Org-Insurance-Work defined as a class group. Then Org-Insurance-Work-Home is defined as belonging to a class group. In the given example the Org-Insurance-Work-Home instances will be stored in the same database table as Org-Insurance-Work instances.
Other rules such as properties would be resolved using the standard Pega 10 step rule resolution process.