Menu

Error, sorting reference list with condition

2008-01-14
2012-11-26
  • Janesh Kodikara

    Janesh Kodikara - 2008-01-14

    Hi Javi
    It gives an error when a reference is sorted by giving a condition.

    Scenario:
    I want to display only QA Engineers in a drop down list of TestCycle model.
    QA engineer details are picked from Resource model. Each QA engineer has a designation. Designations are defined within departments.

    I have following code.

    <reference-view reference="releasebyQA" frame="false">
                <descriptions-list description-property="name"
                                   condition="${designation.department.id} ='QA'"/>
    </reference-view>

    Text "ERROR" appear in the drop down while following appear in the console.

    ..................................................

    SEVERE: Fail executing SELECT RESOURCE_POOL.ID, RESOURCE_POOL.ID, RESOURCE_POOL.NAME from RESOURCE_POOL WHERE T_designation.DEPARTMENT_ID ='QA'
    java.sql.SQLException: Unknown column 'T_designation.DEPARTMENT_ID' in 'where clause'
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
            at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1634)
            at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
            at org.openxava.tab.impl.JDBCTabProvider.nextBlock(JDBCTabProvider.java:235)
            at org.openxava.tab.impl.JDBCTabProvider.nextChunk(JDBCTabProvider.java:258)
            at org.openxava.tab.impl.EntityTabDataProvider.nextChunk(EntityTabDataProvider.java:35)
            at org.openxava.tab.impl.EntityTab.nextChunk(EntityTab.java:296)
            at org.openxava.tab.impl.TableModelBean.getRow(TableModelBean.java:120)
            at org.openxava.tab.impl.TableModelBean.getValueAt(TableModelBean.java:171)
            at org.openxava.tab.impl.XTableModelDecoratorBase.getValueAt(XTableModelDecoratorBase.java:63)
            at org.openxava.tab.impl.HiddenXTableModel.getValueAt(HiddenXTableModel.java:70)
            at org.openxava.calculators.DescriptionsCalculator.read(DescriptionsCalculator.java:105)
            at org.openxava.calculators.DescriptionsCalculator.calculate(DescriptionsCalculator.java:58)
            at org.openxava.calculators.DescriptionsCalculator.getDescriptions(DescriptionsCalculator.java:150)
            at org.apache.jsp.xava.editors.descriptionsEditor_jsp._jspService(descriptionsEditor_jsp.java:208)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
            at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594)
            at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
            at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
            at org.apache.jsp.xava.descriptionsList_jsp._jspService(descriptionsList_jsp.java:303)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

    ..... End of Error message .....

    It was working one level in the reference.

    <reference-view reference="releasebyQA" frame="false">
                <descriptions-list description-property="name"
                                   condition="${designation.id} ='QAL'"/>
    </reference-view>

    Thanking You
    Janesh

     
    • Javier Paniza

      Javier Paniza - 2008-01-15

      Hi Janesh,

      the error is because the table of column in condition is not included in the FROM part.
      This is in this way because OX uses description-properties to determine
      which tables must be included in FROM part.

      A simple workaround is to add your property to description properties, in this way:

      <reference-view reference="releasebyQA" frame="false">
      <descriptions-list description-property="name, designation.department.id"
      condition="${designation.department.id} ='QA'"/>
      </reference-view>

      Cheers
      Javi

       
    • Janesh Kodikara

      Janesh Kodikara - 2008-01-17

      Hola Javi
      It works

      Now department ID appears along with the name :-(

      Thanking You
      Janesh

       
      • Javier Paniza

        Javier Paniza - 2008-01-18

        Hi Janesh,

        > Now department ID appears along with the name
        Yes

        I think in two options for your problem:
        1. Improving OX for supporting your case
        2. Use the 'description-message-id' in <descriptions-list/> that Trifon is developing:
        http://sourceforge.net/forum/forum.php?thread_id=1902159&forum_id=419690

        The option 1 is difficult, because you have to examine the condition (and also the order)
        searching properties to add to the SELECT, and then you have to hide these properties.
        The option 2 is easier because you only have to wait Trifon.

        But, option 1 produces a more intuitive solution for you case from an OX developer viewpoint.

        You choose

        Cheers
        Javi

         

Log in to post a comment.