Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Updation problem  RSS feed

 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a strange behavior from hibernate.

The Problem is

I tried to load a login page in struts 2. This page request a stateless session bean to verify user name and password. The stateless session bean uses hibernate to fetch data from database.

Now when I change the password in the database directly and then use it to login the the change is not reflected. It recognizes old values only.

I am not able to refresh the value....
any help please....
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should never change values in the database directly, when you are doing so, using an application that uses Hibernate or any other ORM framework. The reason being, the ORM framework maintains a cache of the database and depending on how it is configured, the values are reflected back to the database at the end-of-day or some other frequency. Now, to solve your problem, inform in advance the users about the imminent application/application-server restart, on the date/time, restart your application/application-server.
 
Prateek Jauhari
Greenhorn
Posts: 26
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sir,

But This Means If In Case, I made a change in the database then I need to redeploy my whole application on the server.

I have to do this because there a few tables that might be updated, in the application there is no interface provided to update those values.

Will it be right if I create and close a session in with each function call....?
Please advice.

Thanks for the support Sir,

Regards
Prateek
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!