10 Replies Latest reply on Oct 30, 2006 11:45 AM by bsmithjj

    some help with <s:validate/> please...

      Hello,

      I am using the new

      <s:validate/>
      tag.

      I have this facelets component:

       <t:dataTable id="applicationPermissions" value="#{applicationPermissions}" var="permission" rowIndexVar="rowIndex" styleClass="style1" rowClasses=",alt">
      
       <h:column>
       <f:facet name="header">
       Permission Name
       </f:facet>
       <h:panelGroup>
       <h:inputText id="name" value="#{permission.name}" class="textField" size="32">
       <s:validate/>
       </h:inputText>
       <br/>
       </h:panelGroup>
       </h:column>
      
       ...more stuff....
      


      which is included from another facelets component that defines the <h:form>

      I have the Permission entity...

      public class Permission extends BaseTimestampedEntity implements java.io.Serializable {
      
       private static final long serialVersionUID = 1013008880251375639L;
      
       private String name;
       private String description;
       private Application application;
       private boolean active = true; // default is true
       private Set<Role> roles = new HashSet<Role>();
      
       public Permission() { }
      
       public Permission(final String name, final String description) {
       this.name = name;
       this.description = description;
       }
      
       @Column(nullable = false)
       @Length(min=1, max=255)
       public String getName() { return name; }
       public void setName(String name) { this.name = name; }
      
       ... more stuff ...
      
      }
      



      when I submit with an empty value for the name field, I get the following exception:

      14:49:43,258 INFO [ExceptionInterceptor] no exceptions.xml file found
      14:49:43,258 ERROR [ExceptionInterceptor] redirecting to debug page
      javax.ejb.EJBTransactionRolledbackException: org.hibernate.validator.InvalidStateException: validation failed for: com.evergreen.accesscontrol.entity.Permission
       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:201)
       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.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       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.stateful.StatefulContainer.localInvoke(StatefulContainer.java:188)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy327.savePermissions(Unknown Source)
       at com.evergreen.accesscontrol.PermissionManager$$FastClassByCGLIB$$cd9bda13.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:47)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:67)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:28)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.AsynchronousInterceptor.invokeAsynchronouslyIfNecessary(AsynchronousInterceptor.java:29)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:168)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:141)
       at org.jboss.seam.intercept.RootInterceptor.aroundInvoke(RootInterceptor.java:128)
       at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:60)
       at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:47)
       at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$15d0d384.savePermissions(<generated>)
       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:151)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
       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 javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
       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.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.evergreen.filter.RequestDumper.doFilter(RequestDumper.java:78)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
       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 com.evergreen.fastpass.catalina.CASSSOAuthenticatorValve.invoke(CASSSOAuthenticatorValve.java:371)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.hibernate.validator.InvalidStateException: validation failed for: com.evergreen.accesscontrol.entity.Permission
       at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:104)
       at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:127)
       at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:106)
       at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:41)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:165)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:102)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:689)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:671)
       at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:156)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
       at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
       at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
       at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:332)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:131)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:679)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:663)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:667)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:201)
       at org.jboss.ejb3.entity.TransactionScopedEntityManager.merge(TransactionScopedEntityManager.java:181)
       at com.evergreen.accesscontrol.impl.PermissionManagerBean.savePermissions(PermissionManagerBean.java:153)
       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.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:65)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:51)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:77)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:32)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:60)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:50)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.ConversationalInterceptor.checkConversationForConversationalBean(ConversationalInterceptor.java:81)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.EventInterceptor.aroundInvoke(EventInterceptor.java:51)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:40)
       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:17)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:172)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:168)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:141)
       at org.jboss.seam.intercept.RootInterceptor.aroundInvoke(RootInterceptor.java:128)
       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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
       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:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
       ... 91 more
      


      what am I missing here?

      thanks,
      Brad Smith

        • 1. Re: some help with <s:validate/> please...
          pmuir

          JSF only runs validatation (in this case the HibernateValidator via the s:validate/s:validateAll tags) if the input field isn't empty. To check that a field is not null / not an empty string you need to use the required="true" attribute on the JSF component tag.

          • 2. Re: some help with <s:validate/> please...
            pmuir

            I added this to the SeamProblemsFAQ

            • 3. Re: some help with <s:validate/> please...
              atao

               

              SF only runs validatation (in this case the HibernateValidator via the s:validate/s:validateAll tags) if the input field isn't empty. To check that a field is not null / not an empty string you need to use the required="true" attribute on the JSF component tag.


              I use
               @Length(min=1, message="#{messages['job.name.with.at.least.one.char']}")
              


              It works fine even without any required="true" attribute, but only with @Valid/@IfInvalid annotations.

              With s:validate(All) an InvalidStateException is thrown and uncaught when a hibernate validation failed.





              • 4. Re: some help with <s:validate/> please...
                gavin.king

                Correct. But since @IfInvalid is deprecated, I recommend you follow the suggestion of petemuir.

                • 5. Re: some help with <s:validate/> please...
                  atao

                   

                  JSF only runs validatation (in this case the HibernateValidator via the s:validate/s:validateAll tags) if the input field isn't empty. To check that a field is not null / not an empty string you need to use the required="true" attribute on the JSF component tag.
                  bsmithjj
                  Post


                  How to specify Hibernate validation with a field that may stay null? Sth like:

                  @Pattern(regex="^(|\\w(-| |\\w)*)$", message=""#{messages['view.job.name.illegal.char']}")
                  


                  • 6. Re: some help with <s:validate/> please...
                    pmuir

                    I'm sorry, I'm not following you.

                    If the field is null the hibernate validator won't run, if the field is not null any hibernate validators specified will be run. If you need to ensure the field is not null use required="true".

                    • 7. Re: some help with <s:validate/> please...
                      atao

                       

                      If the field is null the hibernate validator won't run


                      As I understood, required="true" is needed to be sure that any hibernate validators specified will be run with s:validate(All).

                      But what about:
                      - if null value, I don't care (a value is optional)
                      - but if a value is written, it needs to respect a pattern, like no punctuation or no number inside the string

                      If I put a required="true" to get the hibernate validation in the second case, then the first case is always rejected by jsf.

                      • 8. Re: some help with <s:validate/> please...
                        pmuir

                        No. Read carefully what I wrote again:

                        If the field is empty the hibernate validator won't run, if the field is not empty any hibernate validators specified will be run.


                        JSF only runs validatation (in this case the HibernateValidator via the s:validate/s:validateAll tags) if the input field isn't empty.


                        For your case just add a s:validate tag without required=true. In other words what I am saying is that all hibernate validators work as you describe EXCEPT @NotNull/@Length(min=1).

                        • 9. Re: some help with <s:validate/> please...
                          atao

                           

                          In other words what I am saying is that all hibernate validators work as you describe EXCEPT @NotNull/@Length(min=1).


                          OK.

                          After some more trials, I found that with no required="true" and:
                          - @NotNull, the null value is accepted!
                          - any other hibernate validation which assumes a non null string, as @Length(min=1), a exception is generated and uncaught.

                          For exemple with a null input :
                          - "^\\w*$" will be fine
                          - "^\\w+$" will throw an uncaught exception

                          Petemuir, thanks for help.

                          • 10. Re: some help with <s:validate/> please...

                            setting required to true worked - thanks for the help.

                            Brad Smith