0 Replies Latest reply on Feb 21, 2010 9:14 PM by Alexander Kudryavtsev

    Search using h:selectOneMenu and EntityQuery (IllegalArgumentException)

    Alexander Kudryavtsev Newbie

      Hello All,
      I'm looking for a help to accomplish my Search page.


      The Search is very simple: select a project from the drop down combobox and display all the time entries for this project.
      My SEAM project was generated using SEAM-GEN and adopted than.


      The problem that it gives java.lang.IllegalArgumentException




      TimeEntriesList.xhtml
      
              <h:form id="timeEntriesSearch" styleClass="edit">
                  <rich:simpleTogglePanel label="TimeEntries Search Filter" switchType="ajax">
                        <s:decorate template="layout/display.xhtml">
                          <ui:define name="label">Project:</ui:define>
                          <h:selectOneMenu id="project" value="#{timeEntriesList.timeEntries.projects}"
                              converter="#{mysqlEntityConverter}">
                              <s:selectItems value="#{projectsList.resultList}" var="_lbl"
                                  label="#{_lbl.name}" noSelectionLabel="Select a project..."/>
                          </h:selectOneMenu>
                      </s:decorate>
                  </rich:simpleTogglePanel>
                  <div class="actionButtons">
                      <h:commandButton id="search" value="Search" action="/TimeEntriesList.xhtml"/>
                      <s:button id="reset" value="Reset" includePageParams="false"/>
                  </div>
              </h:form>



      TimeEntriesList.java
      
      @Name("timeEntriesList")
      public class TimeEntriesList extends EntityQuery<TimeEntries> {
        private static final String EJBQL = "SELECT p,i,u,t FROM TimeEntries t, Projects p, Issues i, Users u WHERE p.id=t.projects.id and i.id=t.issueId and t.userId=u.id ";
        private static final String[] RESTRICTIONS = {
          "t.projects.id=#{timeEntriesList.timeEntries.projects.id}",  };



      TimeEntriesList.page.xml
      
         <param name="project" value="#{timeEntriesList.timeEntries.projects}"/>
      </page>


      components.xml
      <ui:entity-converter name="mysqlEntityConverter" scope="CONVERSATION" precedence="20" entity-loader="#{mysqlEntityLoader}"/>
      <ui:jpa-entity-loader name="mysqlEntityLoader" entity-manager="#{entityManagerMysql}"/>
      <ui:entity-converter name="derbyEntityConverter" scope="CONVERSATION" precedence="20" entity-loader="#{derbyEntityLoader}"/>
      <ui:jpa-entity-loader name="derbyEntityLoader" entity-manager="#{entityManagerDerby}"/>
      <factory name="dynamicEntityManager" scope="SESSION" value="entityManagerMysql" auto-create="true" />



      ERROR:

      ...

      2010-02-21 21:00:19,069 TRACE [org.hibernate.event.def.AbstractFlushingEventListener] (http-127.0.0.1-8080-2) executing flush
      2010-02-21 21:00:19,069 TRACE [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-2) registering flush begin
      2010-02-21 21:00:19,069 TRACE [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-2) registering flush end
      2010-02-21 21:00:19,070 DEBUG [org.hibernate.jdbc.ConnectionManager] (http-127.0.0.1-8080-2) aggressively releasing JDBC connection
      2010-02-21 21:00:19,070 TRACE [org.hibernate.event.def.AbstractFlushingEventListener] (http-127.0.0.1-8080-2) post flush
      2010-02-21 21:00:19,098 TRACE [org.hibernate.transaction.CacheSynchronization] (http-127.0.0.1-8080-2) transaction after completion callback, status: 3
      2010-02-21 21:00:19,098 TRACE [org.hibernate.jdbc.JDBCContext] (http-127.0.0.1-8080-2) after transaction completion
      2010-02-21 21:00:19,098 TRACE [org.hibernate.impl.SessionImpl] (http-127.0.0.1-8080-2) after transaction completion
      2010-02-21 21:00:19,333 TRACE [org.hibernate.jdbc.JDBCContext] (http-127.0.0.1-8080-1) TransactionFactory reported no active transaction; Synchronization not registered
      2010-02-21 21:00:19,333 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] (http-127.0.0.1-8080-1) Looking for a JTA transaction to join
      2010-02-21 21:00:19,333 DEBUG [org.hibernate.jdbc.JDBCContext] (http-127.0.0.1-8080-1) successfully registered Synchronization
      2010-02-21 21:00:19,333 TRACE [org.hibernate.ejb.AbstractEntityManagerImpl] (http-127.0.0.1-8080-1) Adding flush() and close() synchronization
      2010-02-21 21:00:19,364 INFO  [STDOUT] (http-127.0.0.1-8080-1) 21:00:19,362 WARN  [SeamPhaseListener] uncaught exception, passing to exception handler
      javax.el.ELException: java.lang.IllegalArgumentException: java.lang.ClassCastException@4aea4b6b
              at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
              at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:69)
              at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
              at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
              at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
              at org.jboss.seam.core.Expressions$1.setValue(Expressions.java:117)


      Thank you in advance