4 Replies Latest reply on Oct 1, 2007 9:46 AM by Paula

    selectOneMenu with s:selectItems problem

    Paula Newbie

      I am trying to edit a createuser form so that the areaID field is a drop down box populate with values from a table called Areas. When the user is saved, I need to value(either 1, 2, 3 or 4 associated with a label) to be saved in the user table.

      At this point, the drop down populates correctly, but when I create the user, a memory address is saved in the field for the areaID in the user table.

      from createuser.xhtml

      <h:outputLabel>areaID</h:outputLabel>
      <h:selectOneMenu value="#{createuser.user.areaID}" id="areaID">
       <s:selectItems value="#{areas.resultList}" var="ar" label="#{ar.areaName}" hideNoSelection="true" noSelectionLabel="Please Select..."/>
      <s:convertEntity />
      </h:selectOneMenu>
      


      from components.xml
      <framework:entity-query name="areas" ejbql="select ar from Areas ar" />
      


      the variables i am using are strings.

      I've looked for and tried several different things, but so far, it either saves the memory address, null or the drop down doesnt populate.

      Thanks in advance for any help you can give me.

        • 1. Re: selectOneMenu with s:selectItems problem
          Brian Smith Apprentice

          Well it looks like you are trying to pass an entity to a String.

          Why does user have an areaID property? If user has a many to one M:1 relationship with area, shouldn't it just have an area property? This is assuming these are both entities.

          So how about something like this

          <h:outputLabel>areaID</h:outputLabel>
          <h:selectOneMenu value="#{createuser.user.area}" id="areaID">
           <s:selectItems value="#{areas.resultList}" var="ar" label="#{ar.areaName}" hideNoSelection="true" noSelectionLabel="Please Select..."/>
          <s:convertEntity />
          </h:selectOneMenu>


          You need to change your User entity to properly map area.

          Something like this
          @Entity
          public class User {
          ...
          
           @JoinColumn(name="AREA_ID", referencedColumnName="AREA_ID")
           @ManyToOne
           private Area area;
          ...
          }


          • 2. Re: selectOneMenu with s:selectItems problem
            Paula Newbie

            I have tried this but then it no longer allows me to log in.. it tells me that the transaction failed.

            I get an error invoking the login method
            javax.faces.el.EvaluationException: Exception while invoking expression #{authenticator.authenticate}
            Caused by: javax.ejb.EJBTransactionRolledbackException: javax.persistance.PresistanceException: org.hibernate.type.SerializationException: could not deserialize

            Paula

            • 3. Re: selectOneMenu with s:selectItems problem
              Pete Muir Master

              Post the stack trace, use [ code ] tags.

              • 4. Re: selectOneMenu with s:selectItems problem
                Paula Newbie

                ok, here it is

                javax.faces.el.EvaluationException: Exception while invoking expression #{authenticator.authenticate}
                 at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
                 at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
                 at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
                 at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
                 at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
                 at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                 at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
                 at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
                 at org.jboss.seam.security.Identity.authenticate(Identity.java:247)
                 at org.jboss.seam.security.Identity.authenticate(Identity.java:240)
                 at org.jboss.seam.security.Identity.login(Identity.java:170)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                 at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                 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)
                Caused by: javax.ejb.EJBTransactionRolledbackException: javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
                 at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
                 at $Proxy102.authenticate(Unknown Source)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                 at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                 at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
                 at org.javassist.tmp.java.lang.Object_$$_javassist_7.authenticate(Object_$$_javassist_7.java)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
                 ... 69 more
                Caused by: javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
                 at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
                 at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
                 at AuthenticatorAction.authenticate(AuthenticatorAction.java:47)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                 at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                 at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                 at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                 at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                 ... 101 more
                Caused by: org.hibernate.type.SerializationException: could not deserialize
                 at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:217)
                 at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
                 at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
                 at org.hibernate.type.SerializableType.get(SerializableType.java:39)
                 at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
                 at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
                 at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
                 at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2031)
                 at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
                 at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
                 at org.hibernate.loader.Loader.getRow(Loader.java:1197)
                 at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
                 at org.hibernate.loader.Loader.doQuery(Loader.java:689)
                 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
                 at org.hibernate.loader.Loader.doList(Loader.java:2144)
                 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
                 at org.hibernate.loader.Loader.list(Loader.java:2023)
                 at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
                 at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
                 at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
                 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
                 at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
                 at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
                 ... 128 more
                Caused by: java.io.EOFException
                 at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2228)
                 at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694)
                 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761)
                 at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
                 at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:252)
                 at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:209)
                 ... 150 more
                08:42:17,113 WARN [HtmlResponseWriterImpl] HTML nesting warning on closing td: element div not explicitly closed
                08:42:17,113 WARN [HtmlResponseWriterImpl] HTML nesting warning on closing div: element td rendered by component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /login.xhtml][Class: javax.faces.component.html.HtmlForm,Id: login][Class: org.richfaces.component.html.HtmlPanel,Id: _id47][Class: javax.faces.component.html.HtmlPanelGrid,Id: _id49]} not explicitly closed