Inserting Business Object

Storing and updating Complex Type Business Data variable in DB2 Use Case

In most cases the business data will be stored in secure DB. instead of sharedObject, how ever as per the manual shared object provides the synchronous behavior between two processes and users to reflect latest data running parallel which is retrieved from datastore, Due to certain limitations we will trust the Secure DB to store Business Object Data.

There are some scenarios we would really bothersome by using shared object, one of sample scenario is

  • Task A updates and completes and the Task B is started. (Seems like this is called out in the document you quoted, so I would hope it would work).
  • Tasks A and B are both started. Task B postpones and Task A completes with an update. When Task B runs again does the data reflect A's update?
  • Tasks A and B are both started. Task B closes the browser window instead of postponing. Task A completes with an update. When task B runs, does the data reflect A's update?
  • Tasks A and B are both started. When Task B starts, it calls a tw.local.mySharedObject = new tw.object.MySharedType(). Does this change the behavior on any of the above scenarios.

The one that your business users probably will be most grumpy about is that I believe the operation is "last write wins". So on a system where 2 users submit very close in time, the result may appear wrong to one of those users

Lets begin with creating General System Service to store Complex data (Business Data)

Step 1: Create input variable to pass Complex variable from CSHS(Client Side Human Service/HHS(Heritage Human Service)
Step 2: Convert Complex variable to String using the below code provided by system api. this code is useful while preparing parameter type varchar to insert in to the XML Column in DB2
tw.system.serializer.toXml(tw.local.context).toString(true)
Step 3: Prepare SQL and SQL Parameters List as shown in below Pscudo code

INSERT INTO TABLENAME (COLUMN1, COLUMN2) VALUES(?, ?)

tw.local.parameters=new tw.object.listOf.SQLParameter();

var parameter=new tw.object.SQLParameter();
parameter.mode="IN";
parameter.type="VARCHAR";
parameter.value=XXXXX;
tw.local.parameters.insertIntoList(tw.local.parameters.listLength, parameter);

parameter=new tw.object.SQLParameter();
parameter.mode="IN";
parameter.type="VARCHAR";
parameter.value=tw.system.serializer.toXml(tw.local.context).toString(true);
tw.local.parameters.insertIntoList(tw.local.parameters.listLength, parameter);

STep4: The last thing we need to attach the system data service to do inserting by taking input parameters like sql query String, Parameter List & data source name in our case, general these params will change by different services we attach.
Pls Refer the screen shots below

Leave a Reply

Your email address will not be published. Required fields are marked *