4 Replies Latest reply on Mar 31, 2008 8:08 PM by haefti

    Property not found

    haefti

      Hi!
      I have this session bean:



      @Stateless
      @Name("pictureManager")
      public class PictureManagerAction implements PictureManager {
      
           private List<PictureRight> pictureRightList;
           
           private void initPictureRightList() {
                  log.info("initPictureRightList()");
                  Query query = em.createQuery("select p from PictureRight p order by name");
                pictureRightList =  query.getResultList();
                  log.info("Number of rights: " + pictureRightList.size());
           }
      
           public String editPicture() {
                initPictureRightList();
                if (selectedPicture != null) {
                     return "edit";
                } else {
                     return null;
                }
           }
      
           public List<PictureRight> getPictureRightList() {
                log.info("getter called");
                return pictureRightList;
           }



      If I press a button in my application editPicture() and initPictureRightList() is invoked which I can see in the log.


      I get the Hibernate output of the database query and the log message shows how many items are returned from the database.
      I have to assume that the member pictureRightList is not null.


      My following view tries to render this data in a select box but I only get a PropertyNotFoundException.


      The relevant part of the view:


      <h:selectManyListbox size="10" value="#{pictureManager.selectedPicture.pictureRightList}">
           <s:selectItems value="#{pictureManager.pictureRightList}"
           var="pictureRight" label="#{pictureRight.name}" />
           <s:convertEntity />
      </h:selectManyListbox>



      I don't know where the problem is because it looks pretty similar to the Hello World example (avoiding bijection) from the Yuan-book.


      I tried #{pictureRightList} directly and I don't get the exception but the value is null. (I don't know how the variable is transported at all because there is no @Out or is there a implicit outjection?)


      What do I have to do to get the data from the pictureRightList  and display it with or without outjection?


      Thanks!

        • 1. Re: Property not found
          nickarls

          Show the local interface.

          • 2. Re: Property not found
            haefti

            There are only the two public methods of the session bean:


            @Local
            public interface PictureManager {
            
                 public String editPicture();
                 
                 public List<PictureRight> getPictureRightList();
            
            }



            I wonder why the getter is never called. (I never see the getter called in the log.)


            At the moment I changed it to a factory method which works but there has to be a possibility to get the data directly.


            Thanks!

            • 3. Re: Property not found
              pmuir

              1) Always post the exception with the full stack trace


              2) You are missing getSelectedPicture() on pictureManager

              • 4. Re: Property not found
                haefti

                Thanks a lot for the answers!


                The missing getter in the local interface was the problem.