Posted: 28 May 2018 2:52 EDT Last activity: 31 May 2018 1:05 EDT
Step to create a class for external database table
Let's say we have an external database table (CONTRACT) which resides outside of Pega platform and we need to connect to it. I have setup a DataSource in JBOSS application server and also created a new DATA-ADMIN-DB-NAME instance using JDBC Connection Pool. It all works fine.
Now, In order to do Obj-Browse to retrieve data from this external CONTRACT table, I believe I need to create a class for it. I want to verify the standard step. First, I have created a concrete class as MyCo-MyApp-Data-CONTRACT. Then I also created a DATA-ADMIN-DB-TABLE instance for this class to point to external database's table (CONTRACT). Test connection is successful. I created a test activity to do Obj-Browse to get data and it is also successfully loaded on to clipboard.
Here are my questions:
#1. Does the class name MyCo-MyApp-Data-"CONTRACT" have to be exactly identical to the external database table (CONTRACT), or is it arbitrary?
#2. Do we need to create the same properties within MyCo-MyApp-Data-CONTRACT as what they have in external CONTRACT table (ex. ContractID, ContractName, ContractDateTime, etc)? It seems I am able to handle data without having any of these properties.
#3. Should we create a physical database table in our local Pega DATA schema? My guess is no, as we are connecting to external database table and we don't need any duplicate table in our side.
Thanks for clear and concise answer. It is very helpful.
For #2, I understand this will help if we have reports requirements but are there any other advantages? If we don't have reports requirements, do you think it is better not to have properties for the simplicity or still would you have it as it is more "standard" or best practices somehow?
As it is a Data class, Incase if you want to use this class as a page or page list in any other Work class, creating the properties will help you in using them while collecting the details in the case.