-
1. Re: Updating entity beans not refreshed in the web page
haytona Oct 16, 2001 6:47 PM (in response to mack_ng)I am using the same version of jboss/tomcat and am having no problems with updates. If I refresh a web page it hits the app server again and gets the latest data (from JBoss cache usually).
If caching is causing a problem it could be with your browser? -
2. Re: Updating entity beans not refreshed in the web page
mack_ng Oct 16, 2001 9:44 PM (in response to mack_ng)Hi haytona,
I really appreciate your advice. However, after trying to set non-cache for browser, the effect was still the same.
In fact, I tried to print out the result from output screen before relaying the result to the web, and in surprise that the old result is never updated. So it can be concluded that the caching is happening in the EJB level (JBoss), rather than in web level.
I will be grateful if you can share your deployment settings with me to achieve the condition I want to. Hope that other developers will be kind to give some ideas on this issue.
Thanks,
Mack -
3. Re: Updating entity beans not refreshed in the web page
cincaipatron Oct 16, 2001 10:16 PM (in response to mack_ng)Are you using "value object" -- return a serializable
object to client? Are you "cache" the detail (value obj)
as a private field in ejb class? If so, maybe you
just forget to set it to null every time you update
ejb. Common mistake is:
private ValueObject detail = null;
public void updateDetail(ValueObject detail)
{
...
//detail = null; //won't refresh cahed value obj
this.detail = null; // or this.detail = detail;
} -
4. Re: Updating entity beans not refreshed in the web page
mack_ng Oct 17, 2001 1:30 AM (in response to mack_ng)Hi Cincaipatron,
Thanks for your advice. After making the changes that you recommend, it did work. I feel grateful, however, because I am a beginner to EJB, so maybe you are kind to guide me on why we need to set the value object to null in the update method.(I know that it's a good idea to pass value objects, as it will reduce the number of method calls)
Thanks....
Mack -
5. Re: Updating entity beans not refreshed in the web page
cincaipatron Oct 17, 2001 10:49 AM (in response to mack_ng)If we don't set it to null, detail field still refer to
"old detail" (before updated). Usualy in getDetail(),
we check if detail field is not null, the we create
a new one. This is necessary because we don't want
to serialize detail field (just a temporary in memory).
Maybe this will be clearer:
private ValueObject detail = null;
public void updateDetail(ValueObject _detail)
{
fieldA = _detail.getFieldA();
fieldB = _detail.getFieldB();
...
detail = null;
} -
6. Re: Updating entity beans not refreshed in the web page
mack_ng Oct 18, 2001 4:13 AM (in response to mack_ng)Hi,
Thanks Cincaipatron for your explanation. I got what you meant. Once again, I really appreciate your help.
Regards,
Mack