[ 
https://jira.jboss.org/browse/RF-9879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567483#comment-12567483
 ] 

Timmy Storms commented on RF-9879:
----------------------------------

Well, for starters, this is what my JSF page looks like:

<rich:dataTable
        id="myTable"
        var="item"
        value="#{bean.model}"
        rows="#{bean.model.amountOfRows}"
        first="#{bean.model.first}">
        <rich:column filterEvent="onkeyup" filterBy="#{item.title}">
                <f:facet name="header">
                        ...             
                </f:facet>
                <h:outputText value="#{item.title}" />
        </rich:column>
</rich:dataTable>

This data table uses a data scroller component:

<rich:datascroller 
        for="myTable"
        maxPages="7"    
        renderIfSinglePage="false"
        ajaxSingle="false"
        reRender="myTable"
        page="#{bean.model.currentPage}"
        scrollerListener="#{bean.model.scrollerListener}"
        actionListener="#{bean.update}" />

The data model we're using is a subclass of 
org.ajax4jsf.model.SerializableDataModel. This class makes sure that only one 
"page" is queried for in our paginatable data model. A query is rendered as the 
one specified in the issue's description.

I thought I could fix the minus (or dash) sign problem by subclassing the 
org.hibernate.dialect.DB2Dialect.getLimitString(final String query, final int 
offset, final int limit) method. This way I could capture the limit value (see 
issue description) and change -1 value to another value. An implementation 
could look like this:

public final class DB2Dialect extends org.hibernate.dialect.DB2Dialect {
    public String getLimitString(String query, int offset, int limit) {
        if (limit <= 0) {
            limit = 20;
        }
        return super.getLimitString(query, offset, limit);
    }
}

Although the exception is gone now, the data table does not contain any data. 
When I remove the filterEvent and filterBy attributes from the data table 
column, the table renders as expected...

If you still need more specific information, please don't hesitate to ask me!

> ILLEGAL SYMBOL "-" exception when filtering is used on a datatable component
> ----------------------------------------------------------------------------
>
>                 Key: RF-9879
>                 URL: https://jira.jboss.org/browse/RF-9879
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>    Affects Versions: 3.3.3.Final
>         Environment: DB2 8
> Tomcat 6
> Spring 2.5.6
> Hibernate 3.3.2.GA
>            Reporter: Timmy Storms
>            Assignee: Nick Belaevski
>
> When I use filtering on a datatable, I'm getting the following exception when 
> the page is rendered:" com.ibm.db2.jcc.b.SqlException: ILLEGAL SYMBOL "-". 
> SOME SYMBOLS THAT MIGHT BE LEGAL ARE: <IDENTIFIER>".
> It appears that this is caused by the -1 in the following sql statement: 
> select
>      a.b        
> from
>      mytable
> order by
>     upper(column) asc fetch first -1 rows only
> We use DB2 as database. org.hibernate.dialect.DB2390Dialect is the hibernate 
> dialect we use. I've tried the other DB2 ones to.
> I'm wondering if this issue is related to hibernate/db2 or that it originates 
> from the datatable component.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to