Announcement

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

    Updating grid gives sometimes a weird error.

    Hello, using the 30th of june Power nightly.

    In some cases, when I update a grid, the recodr that was updated is removed from the listgrid (not from database, so update succeeds). (myqsl btw)

    Then I get this error:
    Code:
    [ERROR] [generatedcode] - 17:32:01.509:XRP8:WARN:ResultSet:isc_ResultSet_29 (created by: isc_ListGrid_9):Update operation - submitted record with primary key value[s]:{presence_id: 19} returned with modified primary key:[Obj
    ]. This may indicate bad server logic. Updating cache to reflect new primary key.
    [ERROR] [generatedcode] - 17:32:07.101:XRP1:WARN:Log:findByKeys: passed record does not have a value for key field 'presence_id'
    The following was sent to the server:

    Code:
    criteria:{
            presence_id:17
        },
        values:{
            presence_id:17,
            status:"onverwerkt"
        },
        operationConfig:{
            dataSource:"Lecture_presence_Student",
            operationType:"update"
        },
        componentId:"isc_ListGrid_9",
        appID:"builtinApplication",
        operation:"Lecture_presence_Student_update",
        oldValues:{
      ... *snip*
        }
    }
    .ds.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <DataSource ID="Lecture_presence_Student" serverType="sql" tableName="Lecture_presence_Student"> 
      
      <fields> 
        <field name="presence_id" type="sequence" primaryKey="true"/>  
        <field name="Lecture_id" type="integer" foreignKey="Lecture.Lecture_id"/>  
        <field name="Student_id" type="integer" foreignKey="Student.Student_id"/>  
      
        <field name="status" type="enum"  required="true">
        	<valueMap>
        		<value>onverwerkt</value>    	
        		<value>aanwezig</value>
        		<value>afwezig</value>
        	</valueMap>
        </field>
        <field name="reason" type="text" length="255" /> 
      </fields>  
      <operationBindings> 
      *snip*
      </operationBindings> 
    </DataSource>
    grid init code:
    Code:
    grid.setDataSource(presenceDs);
    grid.setAlternateRecordStyles(true);
    grid.setCellHeight(22);
    grid.setAutoFetchData(false);
    grid.setCanEdit(true); 
    grid.setCanRemoveRecords(false);   
    grid.setHeight("100%");
    
    ListGridField id = new ListGridField("presence_id", "id");
    ListGridField first = new ListGridField("firstname", "Voornaam");
    first.setCanEdit(false);
    ListGridField tussenvoegsel = new ListGridField("tussenvoegsel", "Tussenvgsl");
    tussenvoegsel.setCanEdit(false);
    ListGridField surname = new ListGridField("surname", "Achternaam");
    surname.setCanEdit(false);
    ListGridField status = new ListGridField("status","Status");
    ListGridField reason = new ListGridField("reason", "Reden");
    		
    grid.setFields(id,first,tussenvoegsel,surname,status,reason);
    Criteria c = new Criteria();
    		
    c.setAttribute("Lecture_id", lectureRec.getAttribute("Lecture_id"));
    grid.fetchData(c);
    grid.hideField("presence_id");
    addMember(grid);
    Am I doing something wrong here? Why, upon save, is the record removed from the grid (visually only)?

    I don't really get the error message...

    #2
    Changing PK value via update is not allowed. We can't tell whether you changed the PK value because you snipped the relevant part of the log (which is why you should never snip posted logs).

    Records will be removed from view if they no longer match the grid criteria after an update, unless you've set neverDropUpdatedRows on the ResultSet.

    Comment


      #3
      Fair enough, sorry for that.

      The logs shown here indicate that the correct value is sent to the server right? The update is performed correctly. I verified that the PK is indeed 19. Shouldn't it be in the values { } clause, is that what breaks it?

      Log of Development Tab of Eclipse:
      Code:
      12:22:22.842 [ERROR] [generatedcode] 12:22:22.768:XRP8:WARN:ResultSet:isc_ResultSet_47 (created by: isc_ListGrid_14):Update operation - submitted record with primary key value[s]:{presence_id: 19} returned with modified primary key:[Obj
      ]. This may indicate bad server logic. Updating cache to reflect new primary key.
      
      com.smartgwt.client.core.JsObject$SGWT_WARN: 12:22:22.768:XRP8:WARN:ResultSet:isc_ResultSet_47 (created by: isc_ListGrid_14):Update operation - submitted record with primary key value[s]:{presence_id: 19} returned with modified primary key:[Obj
      ]. This may indicate bad server logic. Updating cache to reflect new primary key.
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
          at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
          at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
          at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
          at java.lang.Thread.run(Thread.java:680)

      Log in the Console tab of Eclipse:
      Code:
      === 2011-07-06 12:22:22,637 [0-17] DEBUG XML - Parsed XML from (in memory stream): 3ms
      === 2011-07-06 12:22:22,640 [0-17] DEBUG RPCManager - Processing 1 requests.
      === 2011-07-06 12:22:22,641 [0-17] DEBUG RPCManager - Request #1 (DSRequest) payload: {
          criteria:{
              presence_id:19
          },
          values:{
              presence_id:19,
              reason:"202"
          },
          operationConfig:{
              dataSource:"Lecture_presence_Student",
              operationType:"update"
          },
          componentId:"isc_ListGrid_14",
          appID:"builtinApplication",
          operation:"Lecture_presence_Student_update",
          oldValues:{
              phone:"061",
              reason:"",
              status:"onverwerkt",
              sofinummer:"123123",
              tussenvoegsel:"z",
              street:"a",
              surname:"Student4",
              number:1,
              firstname:"Student4",
              postcode:"1234ab",
              country:"b",
              city:"a",
              archived:false,
              voorletter:"x",
              email:"test@test.nl",
              birthplace:"s",
              cellphone:"061",
              birthdate:new Date(1306188000000),
              active:true,
              gender:"man",
              presence_id:19,
              number_addition:"3"
          }
      }
      === 2011-07-06 12:22:22,644 [0-17] DEBUG AppBase - [builtinApplication.Lecture_presence_Student_update] No userTypes defined, allowing anyone access to all operations for this application
      === 2011-07-06 12:22:22,644 [0-17] DEBUG AppBase - [builtinApplication.Lecture_presence_Student_update] No public zero-argument method named '_Lecture_presence_Student_update' found, performing generic datasource operation
      === 2011-07-06 12:22:22,644 [0-17] INFO  SQLDataSource - [builtinApplication.Lecture_presence_Student_update] Performing update operation with
      	criteria: {presence_id:19}	values: {presence_id:19,reason:"202",SaasCustomer_id:1}
      === 2011-07-06 12:22:22,644 [0-17] INFO  SQLValuesClause - [builtinApplication.Lecture_presence_Student_update] Ignored data for non-existent columns: [SaasCustomer_id]
      === 2011-07-06 12:22:22,667 [0-17] DEBUG PoolableSQLConnectionFactory - [builtinApplication.Lecture_presence_Student_update] Returning pooled Connection
      === 2011-07-06 12:22:22,668 [0-17] DEBUG SQLTransaction - [builtinApplication.Lecture_presence_Student_update] Started new Mysql transaction "1785590954"
      === 2011-07-06 12:22:22,668 [0-17] INFO  SQLDriver - [builtinApplication.Lecture_presence_Student_update] Executing SQL update on 'Mysql': UPDATE Lecture_presence_Student SET reason='202' WHERE (Lecture_presence_Student.presence_id='19')
      === 2011-07-06 12:22:22,669 [0-17] DEBUG SQLDataSource - [builtinApplication.Lecture_presence_Student_update] update operation affected 1 rows
      === 2011-07-06 12:22:22,669 [0-17] INFO  SQLDataSource - [builtinApplication.Lecture_presence_Student_update] primaryKeys: {presence_id=19}
      === 2011-07-06 12:22:22,669 [0-17] INFO  SQLDataSource - [builtinApplication.Lecture_presence_Student_update] Mysql getLastRow(): using default operationBinding
      === 2011-07-06 12:22:22,670 [0-17] DEBUG AppBase - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
      === 2011-07-06 12:22:22,670 [0-17] DEBUG AppBase - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
      === 2011-07-06 12:22:22,671 [0-17] INFO  SQLDataSource - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] Performing fetch operation with
      	criteria: {presence_id:19}	values: {presence_id:19}
      === 2011-07-06 12:22:22,671 [0-17] INFO  SQLDataSource - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] derived query: SELECT $defaultSelectClause , (users.username IS NOT NULL) as userAccount FROM Lecture_presence_Student INNER JOIN Student ON Lecture_presence_Student.Student_id = Student.Student_id LEFT OUTER JOIN users ON Student.Student_id = users.Student_id WHERE $defaultWhereClause
      === 2011-07-06 12:22:22,672 [0-17] INFO  SQLDriver - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] Executing SQL query on 'Mysql': SELECT Student.phone, Student.sofinummer, Student.tussenvoegsel, Student.street, Student.surname, Student.number, Student.firstname, Student.postcode, Student.country, Student.city, Student.archived, Student.voorletter, Student.email, Student.birthplace, Student.Moodle_id, Student.cellphone, Student.birthdate, Student.active, Student.gender, Lecture_presence_Student.presence_id, Student.number_addition , (users.username IS NOT NULL) as userAccount FROM Lecture_presence_Student INNER JOIN Student ON Lecture_presence_Student.Student_id = Student.Student_id LEFT OUTER JOIN users ON Student.Student_id = users.Student_id WHERE (Lecture_presence_Student.presence_id='19')
      === 2011-07-06 12:22:22,674 [0-17] INFO  DSResponse - [builtinApplication.Lecture_presence_Student_update, builtinApplication.null] DSResponse: List with 1 items
      === 2011-07-06 12:22:22,674 [0-17] INFO  DSResponse - [builtinApplication.Lecture_presence_Student_update] DSResponse: List with 1 items
      === 2011-07-06 12:22:22,674 [0-17] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
      === 2011-07-06 12:22:22,674 [0-17] DEBUG SQLTransaction - Committing Mysql transaction "1785590954"
      === 2011-07-06 12:22:22,677 [0-17] DEBUG SQLTransaction - Ending Mysql transaction "1785590954"
      === 2011-07-06 12:22:22,679 [0-17] INFO  Compression - /generatedcode/sc/IDACall: 455 -> 312 bytes
      Last edited by Sytematic; 6 Jul 2011, 02:29.

      Comment


        #4
        And for what it's worth, some content from the developer console:
        presence_id is the PK, and is sent to server correctly.
        Code:
        {
            "dataSource":"Lecture_presence_Student", 
            "operationType":"update", 
            "componentId":"isc_ListGrid_9", 
            "data":{
                "presence_id":24, 
                "reason":"dd.."
            }, 
            "callback":"isc_ListGrid_9.$337(dsResponse, dsRequest)", 
            "willHandleError":true, 
            "showPrompt":false, 
            "oldValues":{
                "phone":"a", 
                "reason":"dd.", 
                "status":"aanwezig", 
                "sofinummer":"1", 
                "street":"1", 
                "surname":"dd", 
                "number":1, 
                "firstname":"dd", 
                "postcode":"1234aa", 
                "city":"a", 
                "country":"a", 
                "archived":false, 
                "email":"xx@sytematic.nl", 
                "birthplace":"dd", 
                "cellphone":"a", 
                "birthdate":"2011-07-04", 
                "gender":"man", 
                "presence_id":24
            }, 
            "clientContext":{
                "saveCallback":null, 
                "newValues":{
                    "presence_id":24, 
                    "reason":"dd.."
                }, 
                "editInfo":{
                    "editValuesID":"_0", 
                    "rowNum":3, 
                    "colNum":4, 
                    "values":'$$BACKREF$$:.dataSource.operationType.componentId.data.callback.willHandleError.showPrompt.oldValues.clientContext.saveCallback.newValues', 
                    "oldValues":{
                        "phone":"a", 
                        "reason":"dd.", 
                        "status":"aanwezig", 
                        "sofinummer":"1", 
                        "street":"1", 
                        "surname":"dd", 
                        "number":1, 
                        "firstname":"dd", 
                        "postcode":"1234aa", 
                        "city":"a", 
                        "country":"a", 
                        "archived":false, 
                        "email":"xx@sytematic.nl", 
                        "birthplace":"dd", 
                        "cellphone":"a", 
                        "birthdate":"2011-07-04", 
                        "gender":"man", 
                        "presence_id":24
                    }, 
                    "editCompletionEvent":"click_outside"
                }
            }, 
            "requestId":"Lecture_presence_Student$62730"
        }
        So it seems that the info going to the server is correct, but after returning, the client things it got something different, something of type '[Obj]', instead of '24'.

        Some typecasting like stuff on the client that doesn't work? Is the PK wrapped in some object, but interpreted as an number?

        Comment


          #5
          It's not anything our server does by default. Look at what's in the RPC tab for the *response* data - does the PK look normal?

          Comment


            #6
            This is what the RPC tab, section Response shows me.
            The PK is 'presence_id', and it looks normal!
            Code:
            [
                {
                    queueStatus:0, 
                    isDSResponse:true, 
                    invalidateCache:false, 
                    status:0, 
                    data:[
                        [
                            {
                                phone:"061", 
                                sofinummer:"123123", 
                                street:"a", 
                                tussenvoegsel:"z", 
                                surname:"Student4", 
                                number:1, 
                                firstname:"Student4", 
                                postcode:"1234ab", 
                                city:"a", 
                                country:"b", 
                                voorletter:"x", 
                                archived:false, 
                                birthplace:"s", 
                                email:"test@test.nl", 
                                cellphone:"061", 
                                birthdate:new Date(1306231200000), 
                                gender:"man", 
                                active:true, 
                                presence_id:19, 
                                number_addition:"3"
                            }
                        ]
                    ]
                }
            I wonder what could be the cause of this, since my grid is very simple, 5 columns, and saving goes by 'autoSaveResults:true' basically...

            As another thing, in some other listgrids in my system, I see the same behaviour, same errors being logged. They both are connected to datasources that join on multiple tables. See the complete DS below. (The DS might look a bit weird, but that's because I generate my SmartGWT code, using SmartGWT as a target language of my generator.)

            Code:
            <?xml version="1.0" encoding="UTF-8"?>
            
            <DataSource ID="Lecture_presence_Student" serverType="sql" tableName="Lecture_presence_Student"> 
              <fields> 
                <field name="presence_id" type="sequence" primaryKey="true"/>  
                <field name="Lecture_id" type="integer" foreignKey="Lecture.Lecture_id"/>  
                <field name="Student_id" type="integer" foreignKey="Student.Student_id"/>  
                <field name="firstname" type="text" tableName="Student" customSQL="true"></field>  
                <field name="tussenvoegsel" type="text" tableName="Student" customSQL="true"></field>  
                <field name="surname" type="text" tableName="Student" customSQL="true"></field>  
                <field name="voorletter" type="text" tableName="Student" customSQL="true"></field>  
                <field name="birthdate" type="date" tableName="Student" customSQL="true"></field>  
                <field name="birthplace" type="text" tableName="Student" customSQL="true"></field>  
                <field name="gender" type="enum" tableName="Student" customSQL="true"> 
                  <valueMap> 
                    <value>man</value>  
                    <value>vrouw</value> 
                  </valueMap> 
                </field>  
                <field name="sofinummer" type="text" tableName="Student" customSQL="true"></field>  
                <field name="street" type="text" tableName="Student" customSQL="true"></field>  
                <field name="number" type="integer" tableName="Student" customSQL="true"></field>  
                <field name="number_addition" type="text" tableName="Student" customSQL="true"></field>  
                <field name="postcode" type="text" tableName="Student" customSQL="true"></field>  
                <field name="city" type="text" tableName="Student" customSQL="true"></field>  
                <field name="country" type="text" tableName="Student" customSQL="true"></field>  
                <field name="phone" type="text" tableName="Student" customSQL="true"></field>  
                <field name="cellphone" type="text" tableName="Student" customSQL="true"></field>  
                <field name="email" type="text" tableName="Student" customSQL="true"></field>  
                <field name="active" type="boolean" tableName="Student" customSQL="true"></field>  
                <field name="archived" type="boolean" tableName="Student" customSQL="true"></field>  
                <field name="Moodle_id" type="integer" tableName="Student" customSQL="true"></field>  
            
                <field name="status" type="enum" required="true"> 
                  <valueMap> 
                    <value>onverwerkt</value>  
                    <value>aanwezig</value>  
                    <value>afwezig</value> 
                  </valueMap> 
                </field>  
                <field name="reason" type="text" length="255"/>  
                <field name="CourseEdition_id" tableName="CourseEdition" customSQL="true" type="integer"/>  
                <field name="students_id" tableName="CourseEdition_students_Student" customSQL="true" type="integer"/>  
              </fields>  
              <operationBindings> 
                <operationBinding requiresRole="ROLE_USER" requiresAuthentication="true" operationType="fetch" customValueFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id" customCriteriaFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id" outputs="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id"> 
                  <selectClause>$defaultSelectClause , (users.username IS NOT NULL) as userAccount</selectClause>  
                  <tableClause>Lecture_presence_Student INNER JOIN Student ON Lecture_presence_Student.Student_id = Student.Student_id LEFT OUTER JOIN users ON Student.Student_id = users.Student_id</tableClause> 
                </operationBinding>  
                <operationBinding requiresRole="ROLE_USER" requiresAuthentication="true" operationType="fetch" operationId="markOffStudents" customValueFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" customCriteriaFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" outputs="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason"> 
                  <selectClause>$defaultSelectClause</selectClause>  
                  <tableClause>Lecture_presence_Student INNER JOIN Student ON Lecture_presence_Student.Student_id = Student.Student_id</tableClause> 
                </operationBinding>  
                <operationBinding requiresRole="ROLE_USER" requiresAuthentication="true" operationType="fetch" operationId="AlsoJoinOnCourseEdition" customValueFields="students_id, CourseEdition_id, presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" customCriteriaFields="students_id, CourseEdition_id,presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" outputs="students_id, CourseEdition_id,presence_id,"> 
                  <tableClause>Lecture_presence_Student INNER JOIN Student ON Lecture_presence_Student.Student_id = Student.Student_id INNER JOIN Lecture ON Lecture_presence_Student.Lecture_id = Lecture.Lecture_id INNER JOIN CourseEdition_students_Student ON CourseEdition_students_Student.Student_id=Student.Student_id INNER JOIN CourseEdition ON Lecture.CourseEdition_id=CourseEdition.CourseEdition_id</tableClause> 
                </operationBinding>  
                <operationBinding requiresRole="" requiresAuthentication="false" operationType="add" cacheSyncOperation="pubfetch" operationId="publicLecturePresence"/>  
                <operationBinding requiresRole="" requiresAuthentication="false" operationType="fetch" operationId="pubfetch"/>  
                <operationBinding requiresRole="ROLE_USER" requiresAuthentication="true" operationType="update" customValueFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" customCriteriaFields="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason" outputs="presence_id, firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,status,reason"/>  
            
              </operationBindings> 
            </DataSource>

            The table structure is:
            Code:
            Lecture(Teacher_id, name, ...) // contains lectures
            Student(Student_id, name, ...) //contains students
            Lecture_presence_Student(Teacher_id, Student_id, present:bool) //contains rows that show if a student attended a lecture
            Not sure if this is any useful information, but I thought I might as well put it here. Is there something obviously wrong in my code?
            Last edited by Sytematic; 8 Jul 2011, 01:58.

            Comment


              #7
              Forget about my last posts, the problem is fixed.

              It had something to do with customValueFields, which was used in an unnecessary way. Simply getting rid of those, and let SmartGWT decide seems to work just fine.

              Comment

              Working...
              X