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

Change database directly ,why hibernate not change

 
mork namafearng
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate not refresh when I change data in database until I restart server,Why?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A SessionFactory is immutable, so once you've configured it its not going to change.
 
mork namafearng
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Paul, But I still not clear this problem,

How should I do, when I edit data in database (by TOAD)

when I come back into web application hibernate not know every thing I change.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh right you are talking about data and not metadata. Well it depends how you get your data in code. If you change data via Toad (or some other app) then have a piece of code which opens a new Session and calls a get method then Hibernate will query the DB for the data. That is unless you are using a Second Level cache, in which case things can be a little more complex. Of course it will be possible, depending on how you have configured Toad, that your updates don't get committed before querying via Hibernate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic