Announcement

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

    Exception about empty values while data is there

    Hello, Using SmartGWT 3.0 Power.

    In my app, I have a button, that resets two values of a field to some default.
    Very simple basically:

    Code:
    disconnect.addClickHandler(new ClickHandler(){
    			public void onClick(ClickEvent event) {
    				DataSource shop = DataSource.get("Shop");
    				Record r = new Record();
    				r.setAttribute("twitterAccessToken","X"+System.currentTimeMillis());
    				r.setAttribute("twitterAccessSecret","X"+System.currentTimeMillis()); 
    				r.setAttribute("Shop_id", rec.getAttributeAsInt("Shop_id"));
    				DSRequest req = new DSRequest();
    				req.setOperationId("UpdateSocialMediaTokens");
    				req.setOldValues(rec);
    				shop.updateData(r, new DSCallback(){
    					public void execute(DSResponse response, Object rawData,DSRequest request) {
    						//....
    					}
    				},req);
    			}
    		});
    The data is sent correctly according to the log, but is still complaining about empty values, but the primary key Shop_id is present, as are two fields:
    Code:
    === 2012-02-23 15:05:25,900 [l0-9] DEBUG XML - Parsed XML from (in memory stream): 2ms
    === 2012-02-23 15:05:25,904 [l0-9] DEBUG RPCManager - Processing 1 requests.
    === 2012-02-23 15:05:25,905 [l0-9] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
            Shop_id:2
        },
        values:{
            twitterAccessToken:"X1330005925718",
            twitterAccessSecret:"X1330005925718",
            Shop_id:2
        },
        operationConfig:{
            dataSource:"Shop",
            operationType:"update"
        },
        appID:"builtinApplication",
        operation:"UpdateSocialMediaTokens",
        oldValues:{
            twitterAccessSecret:"2Ks",
            phone:"061234567",
            zipcode:"1234AB",
            street:"Street2",
            number:"2",
            lng:-105.513,
            country:"nederland",
            city:"City2",
            Shop_id:2,
            shopThumb:"Shop_shopThumb_2_1328437417202.jpg",
            description:"asdfsdf",
            name:"Eetcafé De Michel",
            descriptionLong:"1234545sdfs",
            twitterAccessToken:"961",
            bank_account:"123556",
            lat:39.9626
        }
    }
    === 2012-02-23 15:05:25,905 [l0-9] DEBUG AppBase - [builtinApplication.UpdateSocialMediaTokens] No userTypes defined, allowing anyone access to all operations for this application
    === 2012-02-23 15:05:25,906 [l0-9] DEBUG AppBase - [builtinApplication.UpdateSocialMediaTokens] No public zero-argument method named '_UpdateSocialMediaTokens' found, performing generic datasource operation
    === 2012-02-23 15:05:25,906 [l0-9] INFO  SQLDataSource - [builtinApplication.UpdateSocialMediaTokens] Performing update operation with
    	criteria: {Shop_id:2}	values: {twitterAccessToken:"X1330005925718",twitterAccessSecret:"X1330005925718",Shop_id:2}
    === 2012-02-23 15:05:25,907 [l0-9] WARN  SQLDataSource - [builtinApplication.UpdateSocialMediaTokens] Insert, update or replace operation requires non-empty values; check submitted values parameter
    === 2012-02-23 15:05:25,907 [l0-9] WARN  RequestContext - dsRequest.execute() failed: 
    java.lang.Exception: Insert, update or replace operation requires non-empty values; check submitted values parameter
    	at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1224)
    	at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:293)
    	at com.isomorphic.sql.SQLDataSource.executeUpdate(SQLDataSource.java:241)
    	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1293)
    	at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
    	at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    	at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    	at nl.sytematic.projects.Marktbuzz.server.security.SecureIDACall.processRequest(SecureIDACall.java:100)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at nl.sytematic.projects.Marktbuzz.server.security.SytematicConcurrentSessionFilter.doFilter(SytematicConcurrentSessionFilter.java:62)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.Server.handle(Server.java:324)
    	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    === 2012-02-23 15:05:25,964 [l0-9] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2012-02-23 15:05:25,965 [l0-9] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2012-02-23 15:05:25,965 [l0-9] INFO  Compression - /generatedcode/sc/IDACall: 216 -> 175 bytes
    These are the fields / the operationbinding:
    Code:
     <field name="twitterAccessToken" type="text" required="false" length="128"> 
         
        </field>  
        <field name="twitterAccessSecret" type="text" required="false" length="128"> 
         </field>  
    
    
    <operationBinding operationType="update" requiresAuthentication="true" requiresRole="CAN_UPDATE_SHOP" operationId="UpdateSocialMediaTokens">
        	<customSql>UPDATE Shop SET twitterAccessToken = NULL, twitterAccessSecret = NULL WHERE Shop_id=$criteria.Shop_id</customSql>
        </operationBinding>
    What is going wrong here? It seems like i'm doing something pretty normal?

    PS: Oh in case you wonder: no, twitterAccessTokens are not supposed to be sent to the client, but in my app only a mangled version is sent to the client for some uninteresting reasons.

    #2
    Shop_id is probably not marked as a primaryKey.

    Comment


      #3
      The Shop_id was marked as primary key, but I found out what caused the problem. On these particular fields I had the following .ds.xml declarations:

      Code:
      <field name="twitterAccessToken" type="text" required="false" length="128"> 
              <customSelectExpression>'SOMETHING'</customSelectExpression> 
      
          </field>  
          <field name="twitterAccessSecret" type="text" required="false" length="128"> 
            <customSelectExpression>'SOMETHING'</customSelectExpression> 
          </field>
      Uncommenting the customSelectExpression fixes the problem. Is this supposed to work like that, or have i stumbled upon a bug? Seems to me that the customSelectExpression only applies to fetch operations?
      Last edited by Sytematic; 24 Feb 2012, 00:13.

      Comment


        #4
        That looks like an unintentional side effect, we'll make a note to make an attempt to reproduce this.

        Comment


          #5
          It looks like the problem in this case is that your "customSql" tag should have been "customSQL". Also, we assume you omitted this just for brevity, but you don't have an <operationBindings> tag around your <operationBinding>.

          Comment

          Working...
          X