Here's the session bean snippet...
| @Out(scope=ScopeType.SESSION)
| private DataModel openPackages = new ListDataModel();
|
| private String opQuery = "from PackageEntity p, OfficeEntity o where
p.office.id = o.id and p.code = 'OPN' and o.id = 1";
|
| @Create
| @Factory("openPackages")
| public void init() {
| openPackages.setWrappedData(em.createQuery(opQuery).getResultList());
| openPackages.addDataModelListener(this);
| openPackages.setRowIndex(0);
| }
|
the jsf snippet
| <h:dataTable value="#{openPackages}" var="pkgEntity"
rendered="#{openPackages.rowCount > 0}"
| rows="#{rowSize}" first="#{openIndex}"
rowClasses="evenRow,oddRow" cellspacing="0"
| onmouseover="highlightRow(event);"
onmouseout="unhighlightRow(event);">
| <h:column>
| <f:facet name="header">
| <h:outputText value="#{pkgHeaders.id}" />
| </f:facet>
| <h:commandLink value="#{pkgEntity.id}"
action="#{remittance.selectedRemittance}" />
| </h:column>
| <h:column>
|
| .... more columns ...
| </h:dataTable>
|
the exception i receive...
| java.lang.NumberFormatException: For input string: "id"
| at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
| at java.lang.Integer.parseInt(Integer.java:447)
| at java.lang.Integer.parseInt(Integer.java:497)
| at
com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:138)
| at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
| at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
| at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
| at javax.faces.component.UICommand.getValue(UICommand.java:170)
| at
org.apache.myfaces.renderkit.html.HtmlLinkRendererBase.encodeBegin(HtmlLinkRendererBase.java:87)
| at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:307)
| at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:441)
| at org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
| at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
| at
org.apache.myfaces.renderkit.html.HtmlTableRendererBase.renderColumnBody(HtmlTableRendererBase.java:195)
| at
org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeColumnChild(HtmlTableRendererBase.java:168)
| at
org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:154)
| at
org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
| at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:557)
| at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:562)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:457)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
I believe I know what's wrong but I'm not sure why or how to fix it. So, if you
guys will bear with me and read along I'll explain as best I can.
I think the problem lies in the query which does a join and the resultant List actually
consists of both entity (PackageEntity and OfficeEntity) objects retreive from the
database (using hibernate). The reason I say this is because I had everything working just
fine with the simple query like so
from PacakgeEntity p where p.code = 'OPN'
This simple query returned a list of PackageEntity objects and all was good. The new query
returns a list alright, but it's not a PackageEntity list. It's an Object list.
Each element in the object list then contains a list of PackageEnity and OfficeEntity
objects that were created from the join (so I think).
So, it's seems that I have some sort of referencing problem and I don't really now
how to resolve it. Please ask if you need more information. This is hard to explain.
Thanks.
Eric Ray
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961964#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...