Saving data into SQL table
Hi Community,
I am trying to save data into SQL table but each entry getting saved twice in the SQL table. Is there any reason data is saving Twice in the SQL table
I have created a
Please find the business operation below
Class Patient.DBOperation Extends Ens.BusinessOperation
{
Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";
Property Adapter As EnsLib.SQL.OutboundAdapter;
Parameter INVOCATION = "Queue";
Method OnMessage(pInput As Patient.PatientDBReq, pOutput As Ens.Response) As %Status
{
Set Entry=##class(Patient.PatientDBReq).%New()
Set Entry.PatientID=pInput.PatientID
Set Entry.AdmDateandTime=pInput.AdmDateandTime
Set sc=Entry.%Save()
$$$LOGINFO("Onmessage "_"`"_sc)
Quit sc
}
}
Patient.PatientDBReq Class
Class Patient.PatientDBReq Extends Ens.Request
{
Property PatientID As %Numeric;
Property AdmDateandTime As %DateTime;
}
Thanks,
Smythee
Comments
pInput As Patient.PatientDBReq is automatically persisted. You do not need to explicitly call %Save()
Hi Oliver Wilms
I have used
So if i use %Persistent Extension class for Patient.PatientDBReq class do i need to call %Save() for saving data into SQL table?
Smythe
I understand your original question was why the data was saved twice. I would try to comment out the %Save() and see if you get new data one time.
yes i have commented out %Save() and it worked data is saving only once in the SQL table
and i have checked in Extended classes also but i am not able to find how it is getting saved in SQL table without even Calling %Save()
The object is passed to the SQL Outbound operation. It is a Ens.StreamContainer and Ens.Request which are automatically persisted, meaning saved into the table.
Thank you Oliver