3 Replies Latest reply on Oct 13, 2004 1:01 PM by Scott Jourdan

    Beans Cashed?

    Scott Jourdan Newbie

      Dear Friends,

      I have written an Enity bean that uses bean managed persitance. From a JSP page I call a findAll method that displays all the infrmation in that is stored in the database. Also on the JSP page I have the ability to edit an entry which calls a set* on the EJB then reloades the page. However, the problem is that the ejbLoad methods are not being called on the page refresh. Although the data in the database does get updated, I cannot see the new infromation unless I restart JBOSS and login to the page again. If I dont restart, the page displays as if I never changed any data in the database, and I my Find Method is being called again, but server never performs an ejbLoad on the object it finds during the refresh.

      Are my EJB's being cashed somewhere that is causeing the containter to think they havent changed? Any help?

      Thanks,
      SJ

        • 1. Re: Beans Cashed?
          Robert Szalai Newbie

          Yes, BMP beans are cached by default as far as I know.
          But if you only access the database through your beans, it
          can't cause problems.

          on the JSP page I have the ability to edit an entry which calls a set* on the EJB


          Are you sure you only update data by calling set methods of entity
          bean? In this case, ejbLoad not needing after updating.


          • 2. Re: Beans Cashed?
            Scott Jourdan Newbie

            Yes, I call the set method of the bean. Then the page loads as normal which does a findAll. Then I call the corresponding get Method and the new data is not retrieved. Maybe the bean is cashed before the set method and then calling the get method using the cashed bean that does not have the new info in it?

            As an example of what I am doing the front end:
            var1 = getparameter("var1");
            if (var != null && var1.equals("update"){
            ejb.setMethod(var1);
            }


            <%
            collection = findAll()
            for each { %>
            <%=ejb.getMethod()%>
            <%}%>


            Again, the only way to get the data to show up is to stop jboss and load the page again. Any ideas?

            -SJ

            • 3. Re: Beans Cashed?
              Scott Jourdan Newbie

              I am stumped here!!

              It is not the broweser cashing the bean, it has to be JBOSS. I open an entirely different boswer and load the page and it is still not showing me that data that is the database. The reason for this is becuase for some reason, my findAll method is not calling ejbLoad on the object. Only when I restart JBOSS and load the page will the ejbLoad be called and data retrieved from the database.

              I am stumped here!!

              It is not the broweser cashing the bean, it has to be JBOSS. I open an entirely different boswer and load the page and it is still not showing me that data that is the database. The reason for this is becuase for some reason, my findAll method is not calling ejbLoad on the object. Only when I restart JBOSS and load the page will the ejbLoad be called and data retrieved from the database.

              Here is what I am doing. the page awlays calls does a findALL to display the DB data. Depending on user input a call could be made to one of the beans to call a setMethod() which acts as normal and updates the data in the DB. However, when the page loads again the ejbLoad method is not called. The page loads but shows the data before the setMethod was called. If I restart jboss and open the page again, the ejbLoad method is called, and the data is shown as normal. What is going on here? Any one have an idea?

              -SJ