Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refresh issue for hibernate session

 
Hemant Bharadwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All, I have major problem , suppose in my application I am update dealer and set his status 'Active' and and search it show status 'Active'. then after i upadate same dealer n set status 'Inactive', search it shows 'inactve'like this I set status of same dealer "Suspended" then it show 'suspedned'. but when we refresh our page and or search again it show Inactive or active some times, means last updated value.

I think it store last status value in session. but I closed all session as well as fulsh the session.i am using hibernate for fetching data from datbase.
its refresh problem or it maitian session. so please if anybody knows about then please help. I hanged on it last 1 months
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not really following what you are saying is happening. Can you post your code?

If you've flushed the session then Hibernate's state is the same as the database.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like the value may be cached in the HttpSession, as opposed to the Hibernate Session. Seems like a problem with the front end caching the data, not the back end. Can logging help verify if your program is going to the backend each time it displays the data? It might even just be a default value set in a drop-down list or set of radio buttons in your front end?

-Cameron McKenzie
 
Hemant Bharadwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:Sounds like the value may be cached in the HttpSession, as opposed to the Hibernate Session. Seems like a problem with the front end caching the data, not the back end. Can logging help verify if your program is going to the backend each time it displays the data? It might even just be a default value set in a drop-down list or set of radio buttons in your front end?

-Cameron McKenzie


yes whne i chechk value in datbase it shows right value but during display it shows llast updated value. as well as if print valued during fectching it shows worng value that display on front end. So it is not http session problem it is hibernate session problem that stored last value and so on.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm unconvinced that Hibernate will give you the incorrect value from the database; there's nothing underwriting the data in the application, is there? Like multiple SessionFactories or something weird like that?

My hunch is it's an application or integration problem, not a Hibernate problem. But it's just a hunch. If it was me, I'd be throwing a huge number of logging statements in there and see how, when, why and where that value is being changed. Again, I don't think Hibernate is giving you data that is inconsistent with what is in the database. There's something in your program that's doing that.

Again, just a hunch.

Log, log, log! And log some more!

-Cameron McKenzie
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll second Cameron on this. Unless you are using Hibernate in an unusual way it doesn't do this. Can you post your code?
 
Hemant Bharadwaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are doing is a little odd - why are you mixing JDBC and Hibernate?
 
afsar khan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hemant Bharadwaj wrote:


Why are yolu mixing your JDBC code with Hibernate code. This something vert weird. I can't see anything you are doing with hibernate except closing and flushing the hibernate session. I guess its not a problem of hibernate, The problem lying in this complex code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic