2 Replies Latest reply on Oct 28, 2011 2:18 PM by lightguard

    AroundInvoke type safe ?

    tschleuss

      Hello, i'm trying the Service Handler example to define
      queries on interfaces. But ArraoundInvoke method returns Object tipo
      and not the intercepted method type.. like this


      I have this interface method



           @Query("SELECT s FROM Status s")
           List<Status> getAll();



      and i'm inject her on my manager class, like this:




           @Inject
           private StatusQuery statusQuery;



      the problem is, on my JSF page i'm try this:




      <h:selectOneMenu id="statusList">
           <f:selectItem itemValue="-1" itemLabel="" />
           <f:selectItems
                value="#{br.com.foo.statusQuery.all}"
                var="status"
                itemValue="#{status.id}"
                itemLabel="#{status.description}" />
      </h:selectOneMenu>



      when i'm access the jsp page, i got this exception:




      java.lang.NumberFormatException: For input string: "id"
           at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
           at java.lang.Integer.parseInt(Integer.java:449)
           at java.lang.Integer.parseInt(Integer.java:499)



      Because status is and Object class e not Status class.
      For me this is a bug, because my method return a Status object explicit.
      Theres any workarround for this, i need to create a conversor for this ? it's bad.

        • 1. Re: AroundInvoke type safe ?
          tschleuss

          I resolve the problema with this, but it is ugly




          <h:selectOneMenu id="statusList">
               <f:selectItem itemValue="-1" itemLabel="" />
               <f:selectItems
                    value="#{br.com.foo.statusQuery.all}"
                    var="status"
                    itemValue="#{status[0]}"
                    itemLabel="#{status[1]}" />
          </h:selectOneMenu>



          • 2. Re: AroundInvoke type safe ?
            lightguard

            Odd, really not sure what's going on there.