-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: New data periodically disappears
PostPosted: Mon Jun 28, 2004 8:42 am 
Newbie

Joined: Tue May 25, 2004 3:22 pm
Posts: 18
Hi there.
Maybe someone could help me with my problems..

I am developing a web application ( CMS , Struts + Hibernate) and came across some problems apparently with caching.

The thing is that when I create some new child entity and add it to parent (updating it ;keep in mind that I set cascade="all" for the corresponding list mapping) I can see that child in the UI layer (that is getXXX retrieved that new child) and I also can see that child in appropriated database table (the new row).
But when I hit F5 in a browser subsequently (forcing a corresponding getXXX to retrieve children each time I hit F5) I see that the new child sometimes disappears and after continuing hitting F5 it appears again (and so on...)

Maybe somone could tell me what the problem with inconsistent data while calling getXXX to retrieve child collection could be related to?

thanks in advance,

Igor


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 11:02 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i'm pretty sure you have a mistake in your hibernate session management.
Check open session in view (search in the site), you need threadlocal pattern... it's a complicated word but it is very simple to use and it will simplify your life

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 11:58 am 
Newbie

Joined: Tue May 25, 2004 3:22 pm
Posts: 18
Actually, I am using ThreadLocal patter in my application (as described in Hibernate documantation).
I have implemented a service to wrap up this pattern.

The thing is that my application is multitired, so I'm closing session after each save, update or read of business objects.
And after I add new child object to its parent, update parent and save the new child, I have that object in collection but it disappears and then again appears (and so on and so on) after performing multiple reads (triggered by refreshing the browser's content).
So I'm pretty sure I got problems with session's cache, though can't figure out the cure by now...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 1:04 pm 
Newbie

Joined: Tue May 25, 2004 3:22 pm
Posts: 18
Is there a way to explicitly invalidate cahce?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 1:14 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you do not use the 2nd level cache (default bahavior wo explicit mapping), the session is the only cache container. So there is no reason not to be synchronized.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.