-
1. Re: Seam gen crud and hibernate validator
gardellajuan Dec 5, 2008 10:37 AM (in response to ronaldocwb)See section 6.5. Conversion and Validation of Seam reference. It says:
--Even better, model-based Hibernate validator annotations are automatically recognized and validated.
When type conversion or validation fails, a global FacesMessage is added to the FacesContext.--
If you propagate a parameter, is automatically recognized and validated. I not found a solution, so I remove Hibernate validator annotations.
Sorry my English.
-
2. Re: Seam gen crud and hibernate validator
ronaldocwb Dec 5, 2008 12:26 PM (in response to ronaldocwb)Hi Juan,
Thanks for the awnser! I read the docs, took me to that conclusion too...
Im my opinion it should be validated only where seam validate tag is seted. If a remove HibernateValidator annotations I'll have to validate everything on my own :(. I hope there is some workaround to this situation.If someone have faced the same problem that us and managed to solve in some other way, please post the solution.
Thanks!
-
3. Re: Seam gen crud and hibernate validator
diegocoronel Dec 5, 2008 2:30 PM (in response to ronaldocwb)Are you sure you are not using s:decorate with s:validate inside ? can you post your xhtml ?
-
4. Re: Seam gen crud and hibernate validator
ronaldocwb Dec 5, 2008 4:54 PM (in response to ronaldocwb)Hi Diego,
Yes, i'm sure. In the seam crud the s:validate is used in the edit.xhtml template. The search form uses the display.xhtml template.
Here is the search form:
<h:form id="produtoSearch" styleClass="edit"> <rich:simpleTogglePanel label="Produto Search Filter" switchType="client" style="width:600px;"> <s:decorate template="../../layout/display.xhtml"> <ui:define name="label">Nome</ui:define> <h:inputText id="nome" value="#{produtoList.produto.nome}"/> </s:decorate> <s:decorate template="../../layout/display.xhtml"> <ui:define name="label">Info</ui:define> <h:inputText id="info" value="#{produtoList.produto.info}"/> </s:decorate> </rich:simpleTogglePanel> <div class="actionButtons"> <h:commandButton id="search" value="Search" action="/admin/produto/ProdutoList.xhtml"/> <s:button id="reset" value="Reset"> <f:param name="info"/> <f:param name="nome"/> </s:button> </div> </h:form>
And the template display.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib"> <div class="prop"> <span class="name"> <ui:insert name="label"/> </span> <span class="value"> <ui:insert/> </span> </div> </ui:composition>
These pages were created by seam gen, i just added the hibernate validator annotations and adjusted the layout.
Thanks for your help! If you see some error please tell me.
-
5. Re: Seam gen crud and hibernate validator
joblini Dec 6, 2008 5:56 AM (in response to ronaldocwb)Hi Ronaldo,
This is a known bug, see BypassingValidationsWhenUsingEntityQuery :
These are the conclusions I have drawn :
- Until this is fixed, the only way to use EntityQuery with Hibernate validations is to modify the EntityQuery subclass generated by Seam, replacing the example entity with a Hashmap
- Vote on the Jira issue here
- When one feature is so obviously incompatible with another, it does not reflect well on the framework. I for one was somewhat embarrassed to be preaching how great Seam is to my colleagues, who then encountered this bug in their first hours of trying out Seam.
- Hope that the Seam developers realize how ridiculous this is. I think we all want Seam to be widely accepted, this doesn't help.