top of page

Obj-Save failed - Cannot save instance of class, it belongs to fully exposed table in database, but instance has properties which do not correspond to column

In this blog, we will explore the error that arises when attempting to save a record into a database table using obj-save or activity. I've included the error message below, omitting the class name and property name, so while it may not precisely match your error, the essence remains unchanged.


Cannot save instance of class, it belongs to fully exposed table in database, but instance has properties which do not correspond to column: <ColumnName>


In this error, Pega is indicating that during the generation of an insert query, it encountered a property that is not mapped to any column in the target database table. As previously discussed in our blog, Pega maintains a one-to-one mapping between a class property and a database table column, with each Pega class linked to a database table.


For more information on class and property mapping with database objects, please refer to this blog.g - Decoding Pega's Obj Methods: How Database Operations Work


Returning to the topic, each time the Obj-Save method is executed, Pega generates a query to insert a record into the database table. The Obj-Save method is always executed within the context of a page. The class in Pega determines the database table name to be used in the query, while each property of the page corresponds to a column name. Utilizing this information, Pega constructs the insert query, which is then executed in the backend for the Obj-Save operation.


To resolve this error, please follow these steps:


Ensure the column name mentioned in the error is mapped to a property or not. To accomplish this, open the class definition of the page utilized in Obj-Save. A window will appear. Within this window, navigate to the External Mapping tab.


External mapping of Pega class definition rule
External mapping of Pega class definition rule

To address the error, click on the "+" symbol, enter the column name specified in the error, and provide the corresponding property name of the class. Then, click the "Save" button. Typically, Pega automatically maps the class properties to the columns upon creation. However, there are instances when Pega fails to establish this mapping correctly, and this setting serves as a solution. The error in question arises from such an issue in Pega. After saving, execute the activity again, and it should function correctly this time.


If you love our content, be sure to comment and share our blog with everyone you know! Got a question? Drop a comment below, and we'll get back to you!



Comments


©2022 by pegablogs. Proudly created with Wix.com

bottom of page