Note that there are some explanatory texts on larger screens.

plurals
  1. POWso2 Data Services - Update Operation Issue
    primarykey
    data
    text
    <p>I am experimenting WSO2 DataService Component with MySQL as the database. I exposed the MySQL database as a service using the WSO2 component and was able to use the WSDL to generate Java code.</p> <p>Using the Java CXF Client, I am able to connect to the database and perform the CRUD operations. The prime concern for me now is how WSO2 DSS Component handles Dirty Data. To test the scenario, I have the following code:</p> <pre><code>public class TestService{ //Code to connect to service private void callInsertOperation(HermesCompleteServicePortType port) { ((BindingProvider) port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true); port.beginBoxcar(); port.insertOperation("Key1", "TestData", Double.valueOf(0.00)); try { port.endBoxcar(null); } catch (DataServiceFault e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Insert completed"); } private void callUpdateOperation(HermesCompleteServicePortType port) { ((BindingProvider) port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true); port.beginBoxcar(); port.updateOperation("Key2", "TestData1", Double.valueOf(10.00)); try { port.endBoxcar(null); } catch (DataServiceFault e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Update completed"); } } </code></pre> <p>The issue is in the update operation when the following conditions are true:</p> <ol> <li>Update is on non-existing key, ie, Key2 is not present</li> <li>Update is on old data, ie, key exists but data is stale</li> </ol> <p>In these 2 cases, I would assume the DataService to indicate that the update operation failed/threw an exception/ did not affect any rows. But it does not give any indication and I also checked the wso2 logs to see if there was any message/exception related to this, but none appeared.</p> <p>And obviously, the db table remains unchanged after the update operation.</p> <p>How does WSO2 DSS handle these scenarios? How would the client know if the update operation was not successful? Am I missing something in the code?</p> <p><strong>EDIT</strong> I don't want to use Stored Procedures to check the count of result rows as mentioned <a href="https://stackoverflow.com/questions/13852310/can-wso2-data-service-return-affected-rows-after-sql-update?rq=1">here</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload