1 2 Previous Next 19 Replies Latest reply on Mar 20, 2009 2:09 PM by pdale Go to original post
      • 15. Re: Date comparison under RESTRICTIONS.

        Yes, example:



             <param name="insertionDateFrom"
                  value="#{myEntityList.insertionDateFrom}" converterId="org.jboss.seam.ui.DateTimeConverter"/>
        


        • 16. Re: Date comparison under RESTRICTIONS.

          Hi, Thanks a lot,
          Its working fine with one date but when I put two date


          private static final String[] RESTRICTIONS = {"book.bookPublishedDate between #{bookList.book.bookPublishedDate} and #{bookList.book.bookPublishedEndDate}",};




          I get the following exception:



          Caused by: java.lang.IllegalArgumentException: there should be exactly one value binding in a restriction: book.bookPublishedDate between #{bookList.book.bookPublishedDate} and #{bookList.book.bookPublishedEndDate}
          
               at org.jboss.seam.framework.Query.parseEjbql(Query.java:217)
          
               at org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:169)
          
               at org.jboss.seam.framework.EntityQuery.initResultList(EntityQuery.java:73)
          
               at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:65)
          
          



          Do you know what could be the reason.
          Thanks

          • 17. Re: Date comparison under RESTRICTIONS.
            rhills

            I was the one who suggested you should try a between expression and it looks like I was wrong.  Siarhei said you can't have two EL expressions (I assume s/he meant 'in one restriction' - see Siarhei's comment) and it looks like that is what the exception message there should be exactly one value binding in a restriction is saying.


            It looks like you should return to having two Restrictions, one for the start date and one for the end date, with both parameters defined in your pages.xml file of course.


            HTH,

            • 18. Re: Date comparison under RESTRICTIONS.
              thomas.modeneis

              Ive got same problem here, and ive solved like this:


              so you will need make this workaround to make this stuff work.


              but i cant write my workaround complete here because this validator dont accept codes.


              WTF ? who invented this trash ? lol....



              basically you need set an String to your date and put this on xxxList.page.xml like this:


              param name dataInicio value pedidoList.pedido.dataInicioAux


              and make this transient value setter:
              '
              public void setDataInicioAux(String aux){      
              try{


              SimpleDateFormat sdf  new SimpleDateFormat(EEE MMM dd HH:mm:ss z yyyy,  Locale.US);
              setDataInicio(sdf.parse(aux));
              }'


              and use restrictions used by Siarhei Dudzin.



              If anyone solve this probblem by another way, please report this.



              Thanks all.


              Thanks All.

              • 19. Re: Date comparison under RESTRICTIONS.
                pdale

                In seam 2.1.1 you can pass in the Date Object as a parameter to the transient setter methods - just have to make sure that you have the date converter set in the page.xml. - no need to use SimpleDateFormat

                1 2 Previous Next