0 Replies Latest reply on Jul 29, 2009 5:39 PM by Derk Dukker

    Collection validation with hibernate annotation @Size doesn't work

    Derk Dukker Novice

      Hi all,
      I have a collection which I bind to my rich faces datalist. I want to display a message if the collection has a size bigger than 10. I also want to display a message when it does not have any items in it.
      How do I display different messages for both?
      I now don't even get any message... What am I doing wrong?

      I'm using Seam 1.2.1 with richfaces and hibernate validator 3.0.0. and CXF as webservice. I don't use a database, I only use hibernate validator. I managed to get this work with @Length on a string but now looking for a collection size.

      @Size(max=5, message="#{messages['maxOpleidingenList.length']}")
           public List<IOpleiding> getLettercombinatieOpleidingen() {
                return lettercombinatieOpleidingen;

      my page looks like this:

      <s:decorate id="idBeroepLettercombBeroep"> 
                           <rich:dataList id="lettercombBeroep" var="_beroep" value="#{lettercombinatieBeroepen}">
                                <a4j:commandLink id="beroep" action="#{zoekBeroepAction.retrieveBeroepRelatie(_beroep)}" oncomplete="registreer('#{zoekBeroepAction.beroepRelaties.cdBeroepsnaam}+#{zoekBeroepAction.beroepRelaties.omsBeroepsnaam}+#{_beroep.cdBeroepsnaam}+#{_beroep.omsBeroepsnaam}')">#{_beroep.omsBeroepsnaam}</a4j:commandLink>
                                <h:outputText id="whiteSpace" value="   "/>
                                <a4j:commandLink id="beroepInfoLink" action="#{zoekBeroepAction.retrieveBeroepRelatie(_beroep)}" 
                                reRender="selectedLettercombinatieBeroep" eventsQueue="beroepLetterQueue" ignoreDupResponses="true">
                                    <h:graphicImage id="information" style="border-width:0" value="../images/I.png" />