Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    update operation sends record without primary key

    Hi
    Can anybody help me
    I have datasource with xml dataformat and postxml protocol.
    When I add new record by calling savedata() method for a form, this record appears in the grid. When I edit this new record and call savedata() I have in developer console: "23:38:25.281:XRP9:WARN:Log:findByKeys: passed record does not have a value for key field con_id". Durring "Add" operation server returns exactly same xml as one sended from client plus tag with proper primary key value. For example when client sends xml :
    Code:
    <Connection_data>
      <con_name>My connection</con_name>
      <motor>Oracle</motor>
      <instance>XE</instance>
      <schemat>my schema</schemat>
      <hostip>10.34.23.12</hostip>
      <service>1521</service>
      <login>mylogin</login>
      <passwd>mypasswd</passwd>
      <user_login>userlogin</user_login>
    </Connection_data>
    server returns:
    Code:
    <Connection_data>
      <con_id>2</con_id>
      <con_name>My connection</con_name>
      <motor>Oracle</motor>
      <instance>XE</instance>
      <schemat>my schema</schemat>
      <hostip>10.34.23.12</hostip>
      <service>1521</service>
      <login>mylogin</login>
      <passwd>mypasswd</passwd>
      <user_login>userlogin</user_login>
    </Connection_data>
    As I mentioned before this record appears in the grid but after editing tag con_id is not sent to server during update operation. I am missing something obvious ?


    this is my datasource look like this:
    Code:
    	public ConnectionDS(String id){
    		MyConstants mylocale = GWT.create(MyConstants.class);
    		setID(id);
    		
    		setDataFormat(DSDataFormat.XML);
    		 OperationBinding fetchOB = new OperationBinding();
    		 fetchOB.setOperationType(DSOperationType.FETCH);
    		 fetchOB.setDataProtocol(DSProtocol.POSTXML);
    		 OperationBinding updateOB = new OperationBinding();
    		 updateOB.setOperationType(DSOperationType.UPDATE);
    		 updateOB.setDataProtocol(DSProtocol.POSTXML);
    		 OperationBinding addOB = new OperationBinding();
    		 addOB.setOperationType(DSOperationType.ADD);
    		 addOB.setDataProtocol(DSProtocol.POSTXML);
    		 OperationBinding removeOB = new OperationBinding();
    		 removeOB.setOperationType(DSOperationType.REMOVE);
    		 removeOB.setDataProtocol(DSProtocol.POSTXML);
    			fetchOB.setDataURL(GWT.getModuleBaseURL() + "XmlServlet");//"/pl.com.intuicja.struktura_smartgwt.struktura/XmlServlet");
    			updateOB.setDataURL(GWT.getModuleBaseURL() + "UpdateServlet");//"/pl.com.intuicja.struktura_smartgwt.struktura/UpdateServlet");
    			addOB.setDataURL(GWT.getModuleBaseURL() + "AddServlet");//"/pl.com.intuicja.struktura_smartgwt.struktura/AddServlet");
    			removeOB.setDataURL(GWT.getModuleBaseURL() + "RemoveServlet");//"/pl.com.intuicja.struktura_smartgwt.struktura/RemoveServlet");
    			
    			
    		 
    		setOperationBindings(fetchOB,updateOB,addOB,removeOB);
    		setTagName("Connection_data");
    		setRecordXPath("//user[user_name=" + "'" + userLogin + "']//connection");
    		
    		DataSourceIntegerField pkcon_id = new DataSourceIntegerField("con_id");
    		pkcon_id.setPrimaryKey(true);
    		pkcon_id.setHidden(true);
    		
    		DataSourceTextField con_name  = new DataSourceTextField("con_name",mylocale.txtConName());
    		DataSourceTextField motor = new DataSourceTextField("motor", mylocale.txtMotor());
    		DataSourceTextField instance = new DataSourceTextField("instance", mylocale.txtInstance());
    		DataSourceTextField schemat = new DataSourceTextField("schemat",mylocale.txtSchema());
    		DataSourceTextField hostip = new DataSourceTextField("hostip",mylocale.txtHost());
    		DataSourceTextField service = new DataSourceTextField("service",mylocale.txtPort());
    		DataSourceTextField login = new DataSourceTextField("login",mylocale.txtLogin());
    		DataSourcePasswordField passwd = new DataSourcePasswordField("passwd",mylocale.txtPasswd());
    		setFields(pkcon_id,con_name,motor,instance,schemat,hostip,service,login,passwd);
    	}

    #2
    If you enable the ResultSet log category you can take a look at the data actually received by the ResultSet in response to the "add" operation. This will help isolate where the problem is.

    Comment


      #3
      Hi Isomorphic

      I did as you told me. Now I have in developer console:
      Code:
      00:35:52.265:XRP7:DEBUG:ResultSet:isc_ResultSet_97 (created by: lista):dataSource data changed firing
      00:35:52.265:XRP7:INFO:ResultSet:DSconnection_data:dsResponse for successful operation of type add did not return updated record[s]. Using submitted request data to update ResultSet cache.
      00:35:52.265:XRP7:DEBUG:ResultSet:DSconnection_data:Submitted data to be integrated into the cache:[
      {con_name: "mycon name",
      motor: "Informix",
      instance: "Chmiel",
      schemat: "123t_i9",
      hostip: "12.34.12.34",
      service: "1575",
      login: "login",
      passwd: "passwd",
      user_login: "lazinskip"}
      ]
      00:35:52.281:XRP7:INFO:ResultSet:isc_ResultSet_97 (created by: lista):updating cache in place after operationType: add, allMatchingRowsCached true
      00:35:52.281:XRP7:INFO:ResultSet:isc_ResultSet_97 (created by: lista):Updating cache: operationType 'add' submitted by 'isc_OID_6',1 rows update data:
      [
      {con_name: "mycon name",
      motor: "Informix",
      instance: "Chmiel",
      schemat: "123t_i9",
      hostip: "12.34.12.34",
      service: "1575",
      login: "login",
      passwd: "passwd",
      user_login: "lazinskip"}
      ]
      00:35:52.281:XRP7:INFO:ResultSet:isc_ResultSet_97 (created by: lista):Local filter applied: 7 of 7 records matched filter:{user_login:"lazinskip"}
      00:35:52.343:RDQ0:DEBUG:ResultSet:isc_ResultSet_97 (created by: lista):getRange(0, 6) satisfied from cache
      but I do not understand it. What does it mean that "dsResponse for successful operation of type add did not return updated record[s]", when I comment on server side writing to outputstream my xml document there is no efect,on client side - so something is returned because I see new record

      Comment


        #4
        You're returning some XML, but it's not in the expected format, eg, perhaps you decided to return the data directly instead of including additional tags which are present in the response for a "fetch". Your response for an "add" should match what's being returned for "fetch".

        Comment


          #5
          Thanks

          You are right. My response did not fulfill RecordXPath for this datasource:
          Code:
          setRecordXPath("//user[user_name=" + "'" + userLogin + "']//connection");
          it was:
          Code:
          <Connection_data>
            <con_id>2</con_id>
            <con_name>My connection</con_name>
            <motor>Oracle</motor>
            <instance>XE</instance>
            <schemat>my schema</schemat>
            <hostip>10.34.23.12</hostip>
            <service>1521</service>
            <login>mylogin</login>
            <passwd>mypasswd</passwd>
            <user_login>userlogin</user_login>
          </Connection_data>
          and should be:
          Code:
          <Connection_data>
            <user>
              <user_name>lazinskip</user_name>
              <connection>
                <con_id>1</con_id>
                <con_name>aaa3</con_name>
                <motor>aaa3</motor>
                <instance>2344</instance>
                <schemat>zmiana 16-03-2009</schemat>
                <hostip>aaa3</hostip>
                <service>aaa3</service>
                <login>aaa3</login>
                <passwd>aaa</passwd>
                <user_login>lazinskip</user_login>
              </connection>
            </user>
          </Connection_data>
          That why I got those messages in developer console

          Comment

          Working...
          X