I am using JBoss 4.2.3GA and I am trying to figure out why I can't get this one page to immediately update it's fields. Other pages that have similar rows immediately update thier fields when changes are made.
This is how it works:
I navigate to a page, "BeanSet" that displays a row of attributes for this bean. This row has an edit icon that takes me to another page that allows me make updates to the BeanSet. One of the updates is a comment. I make a comment and click Submit. This takes me back to the BeanSet page. What I expect is that the comment field will show the comment I just made, but instead shows what was there previously. When I check the MySQL table the comment field shows the updated comment correctly. There are other pages that behave similar to this BeanSet page. For instance, a BeerConfigSet page has a row displaying attributes for the BeerConfigSet. I select the edit icon and I am taken to a page where I can update the comment field. When I Submit, I am taken to the previous page and the BeerConfigSet row shows the updated comment!!!
Like I said, the BeanSet page will load the updated comment field after the application times out. So I know the code works, just not when it is supposed to. I have been looking at the jbosscmp-jdbc.xml file. Is it a timing issue? I beleive that it has to be a configuration either in the application or the JBoss server. I have been chasing my tail around for the past week trying to solve this. My head hurts and I am glad it is Friday!
Does anyone have an idea where I should look next?
I really appreciate your help.
Joined: Jan 21, 2009
After doing some more research I stumbled across what may be going on. I still haven't figured it out yet but I wanted to post this out here to possibly generate some ideas.
There is a pattern called ReadOnly/ReadWrite(RO/RW) for EJB entity beans. From what I understand the beanRO is cached data so that the CMP is not constantly hitting the database for data that rarely changes. However, when the data needs to be updated then a beanRW is used to update the data base. After it successfully updates the database the beanRW should notify the beanRO to invalidate it's cache and grab the new data to store into cache. For 99% of my applications beans this works. However, there is this one bean that does not update and invalidate its cached data. What I don't understand is how the beanRW is supposed to notify the beanRO to invalidate and get fresh data. The other caveate is that after the session times out and the application is restarted then it gets the updated data.
I don't know if this helps to explain my situation. I will keep plugging away at this until I either give up and live with this bug or I find a solution which I will post.
Joined: Jan 21, 2009
There are two files used for configuring the container fro CMP, jboss.xml and standardjboss.xml as well as your ejb-jar.xml. I am not 100% percent understanding this so bear with me. I renamed jboss.xml to jboss_DO_NOT_USE_THIS_FILE.xml. I then recompiled my code and deployed the ear file to my server. It now is able to invalidate the cached data and display the updated data correctly as expected.