3 Replies Latest reply on Apr 23, 2010 3:39 AM by Tim Evers

    How to use convertEntity with inputHidden

    Shane Sarver Newbie

      In a form, the following allows a user to select an item from the list correctly:



                     <h:selectOneMenu id="hostSelect" required="true" value="#{remoteJobHome.instance.host}">
                        <s:convertEntity/>
                        <s:selectItems value="#{hostHome.instance}" var="host" label="#{host.name}"/>
                     </h:selectOneMenu> 




      In the case that I already know what is to be assigned to remoteJobHome.instance.host
      How can I perform this assignment using h:inputHidden?


      Pseudo code:


                    <h:inputHidden id="host" binding="#{hostHome.instance}"
                                   value="#{remoteJobHome.instance.host}">
                        <s:convertEntity/>
                    </h:inputHidden>
      



        • 1. Re: How to use convertEntity with inputHidden
          Shane Sarver Newbie

          Goal: The h:selectOneMenu preselects with the selectedHost value defined in components.xml.
          Thus, the user does not need to explicitly select this.  Therefore, I would like to maintain
          this value to persist a newJob when the form is submitted.  Is there a way to put the host value in a hidden field?
          I do not want to use a h:selectOneMenu with s:convertEntity just to make it work.



          Segment from components.xml:



             <factory name="selectedHost" 
                      value="#{hostHome.instance}"/>
          
              <framework:entity-home name="anotherRemoteJobHome" 
                             entity-class="com.test.model.RemoteJob"
                             new-instance="#{newJob}"
                             entity-manager="#{entityManager}"/>
          
              <component name="newJob" 
                       class="com.test.model.RemoteJob">
                <property name="active">true</property>
                <property name="enabled">true</property>
                <property name="failed">true</property>
                <property name="max">20</property>
                <property name="min">10</property>
                <property name="next">#{currentDatetime}</property>
                <property name="start">#{currentDatetime}</property>
                <property name="stop">#{currentDatetime}</property>
                <property name="host">#{selectedHost}</property>
              </component>




          Segment of view.xhtml:


                     <s:decorate id="stopField" template="layout/edit.xhtml">
                          <ui:define name="label">Stop</ui:define>
                          <rich:calendar id="stop"
                            value="#{newJob.stop}" 
                            required="true"
                            datePattern="yyyy-MM-dd HH:mm"/>
                      </s:decorate>
          
                      <s:decorate id="hostField" template="layout/edit.xhtml">
                         <ui:define name="label">Host</ui:define>
                         <h:selectOneMenu id="host" required="true" value="#{newJob.host}">
                            <f:selectItem itemLabel="" itemValue="#{null}"/>
                            <s:convertEntity/>
                            <s:selectItems value="#{hostList.resultList}" var="host" label="#{host.name}"/>
                         </h:selectOneMenu>
                      </s:decorate>
          



          • 2. Re: How to use convertEntity with inputHidden
            Shane Sarver Newbie

            Why does the selection list work but the hidden field does not?


                     <ui:remove>
                        <s:decorate id="hostField" template="layout/edit.xhtml">
                           <ui:define name="label">Host</ui:define>
                           <h:selectOneMenu id="host" required="true" value="#{newJob.host}">
                              <f:selectItem itemLabel="" itemValue="#{null}"/>
                              <s:convertEntity/>
                              <s:selectItems value="#{hostList.resultList}" var="host" label="#{host.name}"/>
                           </h:selectOneMenu>
                        </s:decorate>
                     </ui:remove>
            
                        <h:inputHidden id="host" required="true" value="#{newJob.host}">
                          <s:convertEntity/>
                        </h:inputHidden>
            
                      <h:commandButton id="submit" value="Schedule Job" action="#{remoteJobHome.scheduleJob}" />
            
            



            Error:



            09:58:18,192 SEVERE [application] javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                 at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                 at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                 at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
                 at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
                 at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
                 at com.test.action.RemoteJobHome.scheduleJob(RemoteJobHome.java:71)
                 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:597)
                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                 at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
                 at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                 at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                 at com.test.action.RemoteJobHome_$$_javassist_seam_10.scheduleJob(RemoteJobHome_$$_javassist_seam_10.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:597)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                 at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                 ... 53 more
            Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at org.hibernate.engine.Nullability.checkNullability(Nullability.java:95)
                 at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:313)
                 at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
                 at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
                 at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
                 at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
                 at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
                 at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
                 at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
                 at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
                 at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
                 ... 88 more
            09:58:18,195 WARNING [lifecycle] #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            javax.faces.FacesException: #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
                 at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                 at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                 at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                 ... 52 more
            Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
                 at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
                 at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
                 at com.test.action.RemoteJobHome.scheduleJob(RemoteJobHome.java:71)
                 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:597)
                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                 at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
                 at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
                 at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
                 at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
                 at com.test.action.RemoteJobHome_$$_javassist_seam_10.scheduleJob(RemoteJobHome_$$_javassist_seam_10.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:597)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                 at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                 ... 53 more
            Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
                 at org.hibernate.engine.Nullability.checkNullability(Nullability.java:95)
                 at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:313)
                 at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
                 at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
                 at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
                 at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
                 at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
                 at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
                 at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
                 at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
                 at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
                 ... 88 more
            09:58:18,221 SEVERE [lifecycle] JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /search.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@18edcd9]




            JBoss Seam Debug Page:



            Conversations
            
            Conversation ID      Nested?      Activity      Description      View ID      Action
            16      false      9:58:18 AM - 9:58:24 AM                Select Destroy
            + -  Component (org.jboss.seam.caughtException)
            cause      javax.faces.FacesException: #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            class      class javax.servlet.ServletException
            
            localizedMessage      #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            
            message      #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            
            rootCause      javax.faces.FacesException: #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            stackTrace      [javax.faces.webapp.FacesServlet.service(FacesServlet.java:277), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83), org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178), org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290), org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368), org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495), org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191), org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190), org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433), org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92), org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126), org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102), org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330), org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829), org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598), org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447), java.lang.Thread.run(Thread.java:619)]
            toString()      javax.servlet.ServletException: #{remoteJobHome.scheduleJob}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.model.RemoteJob.host
            
            



            • 3. Re: How to use convertEntity with inputHidden
              Tim Evers Master

              Why are you trying to set the host in the xhtml anyway?
              If you know what the host is supposed to be set it in your code on your new job before rendering the page.
              Then there is no need for a hiddenInput.


              So basically:


              In your seam bean when you create the new Job.
              Set the host to whatever host the default host should be.
              Now your drop down list will have that value automatically selected when the page renders.


              I'm a little confused by some of your comments so not sure if this is what you are after.