Announcement

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

    FilterBuilder crash when using contains

    I actually use a FilterBuilder and when i use on a "String" - "text" field a "contains" - then it raises the following error:

    Actually using SmartClientGWT 2.4 !

    Code:
    20:32:20.859 [ERROR] [cmtclient] 20:32:20.844:RDQ8:WARN:Log:Error:     'The Object does not support the Property or Function.'     in http://127.0.0.1:8888/cmtclient/sc/modules/ISC_Core.js     at line 775 
        [Class Class].startsWith(_1=>true, _2=>"[SKIN]")
            "if(_1==null)return false;return(_1.lastIndexOf(_2,0)==0)"     [c]Canvas.getImgURL(_1=>true, _2=>undef, _3=>[Canvas ID:undefined])     [c]Canvas.imgHTML(_1=>true, _2=>16, _3=>16, _4=>null, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef)     [a]ImgButton.$31r(_1=>true, _2=>Obj{name:hasAttachments}, _3=>[ListGrid ID:isc_ListGrid_0], _4=>Obj, _5=>0, _6=>1)     ListGrid.$315(_1=>true, _2=>Obj, _3=>Obj{name:hasAttachments}, _4=>0, _5=>1)     ListGrid.getCellValue(_1=>Obj, _2=>0, _3=>1, _4=>[GridBody ID:isc_ListGrid_0_body])     [o]GridBody.getCellValue(record=>Obj, rowNum=>0, colNum=>1, gridBody=>[GridBody ID:isc_ListGrid_0_body])     GridRenderer.$22k(_1=>Obj, _2=>0, _3=>1)     GridRenderer.getTableHTML(_1=>undef, _2=>undef, _3=>undef, _4=>undef, _5=>undef, _6=>undef)     GridRenderer.getInnerHTML(undef)     Class.invokeSuper(_1=>null, _2=>"getInnerHTML", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef)     Class.Super(_1=>"getInnerHTML", _2=>Obj{length:1}, _3=>undef)     GridBody.getInnerHTML(undef)     Canvas.$px(_1=>undef)     Canvas.$rd(undef, undef, undef, undef, undef, undef, undef, undef)     ** recursed on Class.invokeSuper

    #2
    Could you rephrase? A test case would be ideal.

    Comment


      #3
      I have a datasource defined like that:
      Code:
      <DataSource ID="mail_messages" serverType="hibernate"
      	tableName="MailMessage" dropExtraFields="true">
      
      	<fields>
      		<field name="mailmessageid" type="sequence" primaryKey="true"
      			canEdit="false" />
      		<field name="subject" type="text" />
      		<field name="fromAddress" type="text" />
                      ....... other fields ........
      	</fields>
      And i use a FilterBuilder to create the Criteria for a ListGrid - and when i use the FilterBuilder with Field "subject" and "contains" with some letters - i get the error posted.

      Code:
      		filterBuilder = new FilterBuilder();
      		filterBuilder.setDataSource(messages);
      
      		grid = new ListGrid();
      		grid.setSelectionType( SelectionStyle.SINGLE );
      		grid.setAlternateRecordStyles( true );
      		grid.setWidth100();
      		grid.setDataSource(messages);
      		grid.setFields(generateListGridFields());
      
      		IButton searchButton = new IButton("Suche");
      		searchButton.addClickHandler(new ClickHandler() {
      			
      			@Override
      			public void onClick(ClickEvent event) {
      				AdvancedCriteria crit = filterBuilder.getCriteria(); 
      				grid.fetchData(filterBuilder.getCriteria());
      			}
      		});

      Comment


        #4
        But to be correct - the error comes when i use the AdvancedCriteria from the FilterBuilder on the ListGrid !

        Code:
        grid.fetchData(filterBuilder.getCriteria());

        Comment


          #5
          The stack trace is totally unrelated to the FilterBuilder. It's a crash that something to do with invalid settings on a field "hasAttachment" that renders images. Somewhere a boolean true value was supplied where a String was expected.

          Comment


            #6
            Here is the debug output

            Code:
            === 2011-01-21 21:11:29,266 [l0-6] DEBUG DataSource - In DS.forName() for 'mail_messages' with DSRequest: com.isomorphic.datasource.DSRequest@1a723d
            === 2011-01-21 21:11:29,267 [l0-6] DEBUG DataSource - Creating instance of DataSource 'mail_messages'
            === 2011-01-21 21:11:29,268 [l0-6] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                criteria:{
                    _constructor:"AdvancedCriteria",
                    operator:"and",
                    criteria:[
                        {
                            fieldName:"subject",
                            operator:"iContains",
                            value:"test"
                        }
                    ]
                },
                operationConfig:{
                    dataSource:"mail_messages",
                    operationType:"fetch",
                    textMatchStyle:"exact"
                },
                startRow:0,
                endRow:75,
                componentId:"isc_ListGrid_0",
                appID:"builtinApplication",
                operation:"mail_messages_fetch",
                oldValues:{
                    _constructor:"AdvancedCriteria",
                    operator:"and",
                    criteria:[
                        {
                            fieldName:"subject",
                            operator:"iContains",
                            value:"test"
                        }
                    ]
                }
            }
            === 2011-01-21 21:11:29,268 [l0-6] INFO  IDACall - Performing 1 operation(s)
            === 2011-01-21 21:11:29,270 [l0-6] DEBUG AppBase - [builtinApplication.mail_messages_fetch] No userTypes defined, allowing anyone access to all operations for this application
            === 2011-01-21 21:11:29,270 [l0-6] DEBUG AppBase - [builtinApplication.mail_messages_fetch] No public zero-argument method named '_mail_messages_fetch' found, performing generic datasource operation
            === 2011-01-21 21:11:29,271 [l0-6] INFO  HibernateDataSource - [builtinApplication.mail_messages_fetch] Performing fetch operation with
            	criteria: {_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"subject",operator:"iContains",value:"test"}]}	values: {_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"subject",operator:"iContains",value:"test"}]}
            === 2011-01-21 21:11:31,419 [l0-6] DEBUG HibernateTransaction - [builtinApplication.mail_messages_fetch] Started new transaction "1494787469"
            Hibernate: 
                select
                    count(*) as y0_ 
                from
                    CMTMailMessage this_ 
                where
                    (
                        (
                            lower(this_.subject) like ? 
                            and this_.subject is not null
                        )
                    )
            WARN  JDBCExceptionReporter - SQL Error: 8116, SQLState: S0001
            ERROR JDBCExceptionReporter - Argument data type text is invalid for argument 1 of lower function.
            === 2011-01-21 21:11:31,441 [l0-6] WARN  HibernateTransaction - [builtinApplication.mail_messages_fetch] Rolling back 0 database update(s)
            === 2011-01-21 21:11:31,442 [l0-6] DEBUG HibernateTransaction - [builtinApplication.mail_messages_fetch] Rolling back transaction "1494787469"
            === 2011-01-21 21:11:31,445 [l0-6] DEBUG HibernateTransaction - [builtinApplication.mail_messages_fetch] Removed transaction "1494787469"
            === 2011-01-21 21:11:31,445 [l0-6] WARN  RequestContext - dsRequest.execute() failed: 
            org.hibernate.exception.SQLGrammarException: could not execute query
            	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
            	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
            	at org.hibernate.loader.Loader.doList(Loader.java:2536)
            	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
            	at org.hibernate.loader.Loader.list(Loader.java:2271)
            	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
            	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1717)
            	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
            	at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
            	at com.isomorphic.hibernate.HibernateDataSource.buildCriteria(HibernateDataSource.java:1055)
            	at com.isomorphic.hibernate.HibernateDataSource.processRequest(HibernateDataSource.java:740)
            	at com.isomorphic.hibernate.HibernateDataSource.executeFetch(HibernateDataSource.java:453)
            	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1048)
            	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:1443)
            	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:173)
            	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:130)
            	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:95)
            	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54)
            	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.handle(ServletHandler.java:362)
            	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)
            Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Argument data type text is invalid for argument 1 of lower function.
            	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
            	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
            	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
            	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
            	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
            	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
            	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
            	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
            	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283)
            	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
            	at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
            	at org.hibernate.loader.Loader.doQuery(Loader.java:802)
            	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
            	at org.hibernate.loader.Loader.doList(Loader.java:2533)
            	... 38 more
            === 2011-01-21 21:11:31,447 [l0-6] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2011-01-21 21:11:31,448 [l0-6] DEBUG DataSource - In DS.forName() for 'mail_messages' with DSRequest: com.isomorphic.datasource.DSRequest@1a723d
            === 2011-01-21 21:11:31,449 [l0-6] DEBUG DataSource - Creating instance of DataSource 'mail_messages'
            === 2011-01-21 21:11:31,449 [l0-6] DEBUG RPCManager - non-DMI response, dropExtraFields: true
            === 2011-01-21 21:11:31,450 [l0-6] DEBUG DataSource - In DS.forName() for 'mail_messages' with DSRequest: com.isomorphic.datasource.DSRequest@1a723d
            === 2011-01-21 21:11:31,450 [l0-6] DEBUG DataSource - Creating instance of DataSource 'mail_messages'
            === 2011-01-21 21:11:31,451 [l0-6] INFO  HibernateTransaction - Attempting to commit null database update(s)
            === 2011-01-21 21:11:31,452 [l0-6] DEBUG HibernateTransaction - Committing transaction "1494787469"
            === 2011-01-21 21:11:31,452 [l0-6] WARN  HibernateTransaction - Could not commit, attempting to rollback null database update(s)
            === 2011-01-21 21:11:31,452 [l0-6] DEBUG HibernateTransaction - Removed transaction "1494787469"
            === 2011-01-21 21:11:31,452 [l0-6] WARN  HibernateDataSource - Encountered exception committing inline transaction during freeResources()
            org.hibernate.TransactionException: Transaction not successfully started
            	at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:179)
            	at com.isomorphic.hibernate.HibernateTransaction.commitTransaction(HibernateTransaction.java:210)
            	at com.isomorphic.hibernate.HibernateTransaction.commitTransaction(HibernateTransaction.java:188)
            	at com.isomorphic.hibernate.HibernateDataSource.freeResources(HibernateDataSource.java:2013)
            	at com.isomorphic.datasource.DSRequest.freeResources(DSRequest.java:2758)
            	at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:1174)
            	at com.isomorphic.rpc.RPCManager.send(RPCManager.java:582)
            	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:130)
            	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:95)
            	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54)
            	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.handle(ServletHandler.java:362)
            	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)

            Comment


              #7
              its a sqlserver 2005 issue !!
              Found it - changed the "text" to a varchar column !

              thanks

              Comment


                #8
                it is independant of the column type ....
                the problem still persists - even when changed the type to varchar(max) instead of "text"

                Comment


                  #9
                  Originally posted by Isomorphic
                  The stack trace is totally unrelated to the FilterBuilder. It's a crash that something to do with invalid settings on a field "hasAttachment" that renders images. Somewhere a boolean true value was supplied where a String was expected.
                  hasAttachment is a boolean field - it has nothing to do with an image
                  And i do not supply anything - i only take the result from the FilterBuilder ...

                  Comment


                    #10
                    The JavaScript error could ultimately be due to the server crash (which appears to happen first).

                    As far as the server crash, valid criteria are being passed to Hibernate and Hibernate is apparently forming invalid SQL. This indicates something is wrong with your Hibernate mappings and/or database driver - wish we could help further but this is not a SmartGWT problem.

                    If you were using the SQLDataSource (the recommendation in the docs), Hibernate would not be involved so this problem could not arise.

                    Comment

                    Working...
                    X