• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate query error

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm studying Hibernate by my self. I've created a query to check the username & password which are passed through the front end.



This works. But the issue is when I make a change in the database, the results shows the old information where it should show the new information. Further I need to redeploy the project or restart the server in order to show the new data.

Can anyone help me on this?
 
Ranch Hand
Posts: 63
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When do you make change in the database?
If you are doing same time while application is running then how it will reflect the changes in data from back end as it has loaded in the session earlier.
 
Ranch Hand
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do the changes, but ensure that you update this information through hibernate itself.
That way your entities and their associated cache will be updated first and the changes persisted to the database.
 
Sumer Selvaraj
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Niraj Jha wrote:When do you make change in the database?
If you are doing same time while application is running then how it will reflect the changes in data from back end as it has loaded in the session earlier.



Ya I've changed the value while the programme is running. As per you, I've cleared the session but it didn't work. The new codes are

testHibernate Class



JSP page
 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

If you put java code into jsp page then it is wrong old way. Now it is not good practice. Your jsp page should not contain java code!

You need to understand that entity has three states - transient, persistent and detached. Changes made to entity in persistent state are stored into database when your transaction is committed. I recommend you to pass these free tutorials on hibernate
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To understand better hibernate objects state you MUST read relevant chapter in hibernate doc
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic