7 Replies Latest reply on Mar 19, 2008 11:48 AM by Pericles Junior

    Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys

    Pericles Junior Newbie

      Hi again,


      I'm in blind alley with this error:




      Exception during request processing:
      Caused by javax.servlet.ServletException with message: "#{permisosTipologiaHome.persist}: org.hibernate.validator.InvalidStateException: validation failed for: es.gematic.gucudo.entity.PermisosTipologia"
      
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
      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.MultipartFilter.doFilter(MultipartFilter.java:85)
      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:141)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      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:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      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:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:619)
      



      It was produced when the form generated by Seam Generate Entities is, I supose, charged.



          <h:form id="permisosTipologia" styleClass="edit">
          
              <rich:panel>
                  <f:facet name="header">#{permisosTipologiaHome.managed ? messages['Edit']:messages['Add']} #{messages['PermissionType']}</f:facet>
      
      
                  <s:decorate id="idTipologiaDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">#{messages['idDocumentType']}</ui:define>
                                       
      
                        <h:inputText id="idTipologia"
                             required="true"
                             disabled="#{permisosTipologiaHome.managed}"
                                value="#{permisosTipologiaHome.instance.id.idTipologia}">
                        
                          <a:support event="onblur" reRender="idTipologiaDecoration" bypassUpdates="true" ajaxSingle="true"/>
                      </h:inputText>
      
                  </s:decorate>
      
      
                  <s:decorate id="idTipusDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">#{messages['idPermissionType']}</ui:define>
                                              
      
                        <h:inputText id="idTipus" 
                            required="true"
                            disabled="#{permisosTipologiaHome.managed}"                      
                                size="1"
                           maxlength="1"
                               value="#{permisosTipologiaHome.instance.id.idTipus}">
                        
                          <a:support event="onblur" reRender="idTipusDecoration" bypassUpdates="true" ajaxSingle="true"/>
                      </h:inputText>
      
                  </s:decorate>
      
                  <s:decorate id="idUsuariDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">#{messages['idUser']}</ui:define>
                                               
      
                      <h:inputTextarea id="idUsuari"
                                 disabled="#{permisosTipologiaHome.managed}"
                                 required="true"
                                    value="#{permisosTipologiaHome.instance.id.idUsuari}"/>
      
                  </s:decorate>
                  
                  
                  <div style="clear:both">
                      <span class="required">*</span> 
                      #{messages['requiredFields']}
                  </div>
                  
              </rich:panel>
                      
              <div class="actionButtons">
      
                  <h:commandButton id="save" 
                                value="#{messages['Save']}" 
                               action="#{permisosTipologiaHome.persist}"
                             disabled="#{!permisosTipologiaHome.wired}"
                             rendered="#{!permisosTipologiaHome.managed}"/>  
                                                        
                  <h:commandButton id="update" 
                                value="#{messages['Save']}" 
                               action="#{permisosTipologiaHome.update}"
                             rendered="#{permisosTipologiaHome.managed}"/>
                                                        
                  <h:commandButton id="delete" 
                                value="#{messages['Delete']}" 
                               action="#{permisosTipologiaHome.remove}"
                            immediate="true"
                             rendered="#{permisosTipologiaHome.managed}"/>
                          
                  <s:button id="done" 
                         value="#{messages['Done']}"
                   propagation="end"
                          view="/PermisosTipologia.xhtml"
                      rendered="#{permisosTipologiaHome.managed}"/>
                      
                  <s:button id="cancel" 
                         value="#{messages['Cancel']}"
                   propagation="end"
                          view="/#{empty permisosTipologiaFrom ? 'PermisosTipologiaList' : permisosTipologiaFrom}.xhtml"
                      rendered="#{!permisosTipologiaHome.managed}"/>
      
              </div>
          </h:form>




      The line that dont't work:


      disabled="#{!permisosTipologiaHome.wired}"



      This line disabled or not the save button, in ALL the components ...Home.java generated by Seam Generated Entities in my project this line call to the next function.




             public boolean isWired() {
      
                      if (getInstance().getTypes() == null)
                              return false;
                      if (getInstance().getUsers() == null)
                              return false;
                      if (getInstance().getPermissionType() == null)
                              return false;
                      
                      return true;
              }





      Well, always in my project, all the components created with foreign keys has this problem, the button doesn't work and if I enable it and click it shows the error of the top of this post.


      Anybody knows why?


      Thank you very much.

        • 1. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
          Keith Naas Novice

          Javi,


          Even though an input field is disabled, it is can still be validated by the validation framework.  The easiest way to get around it is to not render the field using the rendered attribute instead of using the disabled attribute.  


          You can always toggle between a read only outputText and an input if you still need to see the underlying values.


          <h:outputText value="#{bean.property}" rendered="#{disabled}"/>
          <h:inputText value="#{bean.property}" rendered="#{not disabled}"/>
          



          Keith


          • 2. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
            Pericles Junior Newbie

            Thanks Keith, fastest reply of the day, ;)


            but...


            The disabled component it's a Button and the error is relationated with hibernate, do you think in your way I can solve it?


            The component doesn't work is this.


            <h:commandButton id="save" 
               value="#{messages['Save']}" 
               action="#{permisosTipologiaHome.persist}"
               disabled="#{!permisosTipologiaHome.wired}"
               rendered="#{!permisosTipologiaHome.managed}"/>



            Thanks a lot again.

            • 3. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
              Pericles Junior Newbie

              Hi again, I prove it but the error persists.


              Now The button is enabled but when I clicking it I have the same error.



              Exception during request processing:
              Caused by javax.servlet.ServletException with message: "#{permisosTipologiaHome.persist}: org.hibernate.validator.InvalidStateException: validation failed for: es.gematic.gucudo.entity.PermisosTipologia"
              
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
              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.MultipartFilter.doFilter(MultipartFilter.java:85)
              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:141)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
              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:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              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:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              
              Caused by javax.faces.FacesException with message: "#{permisosTipologiaHome.persist}: org.hibernate.validator.InvalidStateException: validation failed for: es.gematic.gucudo.entity.PermisosTipologia"
              
              com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
              javax.faces.component.UICommand.broadcast(UICommand.java:383)
              org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
              org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
              org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
              com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
              com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              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.MultipartFilter.doFilter(MultipartFilter.java:85)
              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:141)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
              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:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              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:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              
              Caused by javax.faces.el.EvaluationException with message: "org.hibernate.validator.InvalidStateException: validation failed for: es.gematic.gucudo.entity.PermisosTipologia"
              
              javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
              com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
              javax.faces.component.UICommand.broadcast(UICommand.java:383)
              org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
              org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
              org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
              com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
              com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              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.MultipartFilter.doFilter(MultipartFilter.java:85)
              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:141)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
              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:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              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:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              
              Caused by org.hibernate.validator.InvalidStateException with message: "validation failed for: es.gematic.gucudo.entity.PermisosTipologia"
              
              org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:143)
              org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:167)
              org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:156)
              org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:49)
              org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
              org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
              org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
              org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
              org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
              org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
              org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)
              org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:90)
              org.jboss.seam.framework.EntityHome.persist(EntityHome.java:85)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              java.lang.reflect.Method.invoke(Method.java:597)
              org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
              org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
              org.jboss.seam.util.Work.workInTransaction(Work.java:40)
              org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
              org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
              org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
              es.gematic.gucudo.session.PermisosTipologiaHome_$$_javassist_16.persist(PermisosTipologiaHome_$$_javassist_16.java)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              java.lang.reflect.Method.invoke(Method.java:597)
              org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
              org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
              org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
              org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
              org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
              com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
              javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
              com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
              javax.faces.component.UICommand.broadcast(UICommand.java:383)
              org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
              org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
              org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
              com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
              com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              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.MultipartFilter.doFilter(MultipartFilter.java:85)
              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:141)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
              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:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              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:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              





              If anyone knows how can I resolve it, please, explain me.


              Thanks a lot.

              • 4. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
                Pericles Junior Newbie

                I uping it because maybe anyone woh don't readed and know the answer can read it.


                Sorry if this is inappropriate.

                • 5. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
                  Pete Muir Master

                  You need to work out which field is causing the invalid state exception and why there is an invalid value in it which isn't being validated. Post your entity.

                  • 6. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
                    Pericles Junior Newbie

                    This is my Entity. Thanks. ;)


                    package es.gematic.gucudo.entity;
                    
                    // Generated 10-mar-2008 10:23:27 by Hibernate Tools 3.2.0.CR1
                    
                    import javax.persistence.Column;
                    import javax.persistence.Embeddable;
                    import org.hibernate.validator.Length;
                    import org.hibernate.validator.NotNull;
                    
                    /**
                     * PermisosTipologiaId generated by hbm2java
                     */
                    @Embeddable
                    public class PermisosTipologiaId implements java.io.Serializable {
                    
                         private long idTipologia;
                         private String idTipus;
                         private String idUsuari;
                    
                         public PermisosTipologiaId() {
                         }
                    
                         public PermisosTipologiaId(long idTipologia, String idTipus, String idUsuari) {
                              this.idTipologia = idTipologia;
                              this.idTipus = idTipus;
                              this.idUsuari = idUsuari;
                         }
                    
                         @Column(name = "ID_TIPOLOGIA", nullable = false, precision = 14, scale = 0)
                         @NotNull
                         public long getIdTipologia() {
                              return this.idTipologia;
                         }
                    
                         public void setIdTipologia(long idTipologia) {
                              this.idTipologia = idTipologia;
                         }
                    
                         @Column(name = "ID_TIPUS", nullable = false, length = 1)
                         @NotNull
                         @Length(max = 1)
                         public String getIdTipus() {
                              return this.idTipus;
                         }
                    
                         public void setIdTipus(String idTipus) {
                              this.idTipus = idTipus;
                         }
                    
                         @Column(name = "ID_USUARI", nullable = false)
                         @NotNull
                         public String getIdUsuari() {
                              return this.idUsuari;
                         }
                    
                         public void setIdUsuari(String idUsuari) {
                              this.idUsuari = idUsuari;
                         }
                    
                         public boolean equals(Object other) {
                              if ((this == other))
                                   return true;
                              if ((other == null))
                                   return false;
                              if (!(other instanceof PermisosTipologiaId))
                                   return false;
                              PermisosTipologiaId castOther = (PermisosTipologiaId) other;
                    
                              return (this.getIdTipologia() == castOther.getIdTipologia())
                                        && ((this.getIdTipus() == castOther.getIdTipus()) || (this
                                                  .getIdTipus() != null
                                                  && castOther.getIdTipus() != null && this.getIdTipus()
                                                  .equals(castOther.getIdTipus())))
                                        && ((this.getIdUsuari() == castOther.getIdUsuari()) || (this
                                                  .getIdUsuari() != null
                                                  && castOther.getIdUsuari() != null && this
                                                  .getIdUsuari().equals(castOther.getIdUsuari())));
                         }
                    
                         public int hashCode() {
                              int result = 17;
                    
                              result = 37 * result + (int) this.getIdTipologia();
                              result = 37 * result
                                        + (getIdTipus() == null ? 0 : this.getIdTipus().hashCode());
                              result = 37 * result
                                        + (getIdUsuari() == null ? 0 : this.getIdUsuari().hashCode());
                              return result;
                         }
                    
                    }



                    • 7. Re: Problem: Generate Entities, xhtml files, isWired() funtion and foreign keys
                      Pericles Junior Newbie

                      And this is my Home component, maybe it's useful.



                      package es.gematic.gucudo.session;
                      
                      import es.gematic.gucudo.entity.*;
                      import org.jboss.seam.annotations.In;
                      import org.jboss.seam.annotations.Name;
                      import org.jboss.seam.framework.EntityHome;
                      
                      @Name("permisosTipologiaHome")
                      public class PermisosTipologiaHome extends es.cambrabcn.seam.framework.framework.EntityHome<PermisosTipologia> {
                      
                           @In(create = true)
                           TipologiesHome tipologiesHome;
                           @In(create = true)
                           UsuarisHome usuarisHome;
                           @In(create = true)
                           TipusPermisHome tipusPermisHome;
                      
                           public void setPermisosTipologiaId(PermisosTipologiaId id) {
                                setId(id);
                           }
                      
                           public PermisosTipologiaId getPermisosTipologiaId() {
                                return (PermisosTipologiaId) getId();
                           }
                      
                           public PermisosTipologiaHome() {
                                setPermisosTipologiaId(new PermisosTipologiaId());
                           }
                      
                           @Override
                           public boolean isIdDefined() {
                                if (getPermisosTipologiaId().getIdTipologia() == 0)
                                     return false;
                                if (getPermisosTipologiaId().getIdTipus() == null
                                          || "".equals(getPermisosTipologiaId().getIdTipus()))
                                     return false;
                                if (getPermisosTipologiaId().getIdUsuari() == null
                                          || "".equals(getPermisosTipologiaId().getIdUsuari()))
                                     return false;
                                return true;
                           }
                      
                           @Override
                           protected PermisosTipologia createInstance() {
                                PermisosTipologia permisosTipologia = new PermisosTipologia();
                                permisosTipologia.setId(new PermisosTipologiaId());
                                return permisosTipologia;
                           }
                      
                           public void wire() {
                                Tipologies tipologies = tipologiesHome.getDefinedInstance();
                                if (tipologies != null) {
                                     getInstance().setTipologies(tipologies);
                                }
                                Usuaris usuaris = usuarisHome.getDefinedInstance();
                                if (usuaris != null) {
                                     getInstance().setUsuaris(usuaris);
                                }
                                TipusPermis tipusPermis = tipusPermisHome.getDefinedInstance();
                                if (tipusPermis != null) {
                                     getInstance().setTipusPermis(tipusPermis);
                                }
                           }
                      
                           public boolean isWired() {
                                
                                if (getInstance().getTipologies() == null)
                                     return false;
                                if (getInstance().getUsuaris() == null)
                                     return false;
                                if (getInstance().getTipusPermis() == null)
                                     return false;
                                
                                return true;
                           }
                      
                           public PermisosTipologia getDefinedInstance() {
                                return isIdDefined() ? getInstance() : null;
                           }
                      
                      }