0
votes

I am trying to achieve below scenario, could any one guide on whether it's possible or not.

I have a system which call WSO2 DSS with certain parameters like name,Age,DOB etc

So the request will be like this

<Employee>
<ID>1</ID>
<Name>Amit</Name>
<Age>10</Age>
</Employee>

Now initially as it's a new records hence this is inserted in DB , However if there is any modification in the above then an update query needs to be fired to DB for example :

update [Table-Name] set Age = :Age where  (ID= :ID);

So the above will update age for the employee.

Now what if the name of the employee needs to be updated, then how can i frame update statement in wso2 dss so that this use case can be handled?Because there are multiple fields which can be update any time.

I am not sure whether such a use case is valid or not and whether wso2 dss will be able to support this requirement.

1

1 Answers

0
votes

You can use the following query in your WSO2 DSS (it was tested on version 3.5.0) to be able to handle both insert new records and updates existing records (if ID is your primary key in the database).

insert into [Table-Name] (ID, Name, Age) values (:ID, :Name, :Age)
ON DUPLICATE KEY
    UPDATE Age=Age, Name=Name