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

reloading session

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys :

Im trying to reload hibernate completely after a delete. For some reason, even if I close the sessionfactory, close the session, and set both to null,
when I reopen a new session factory it is not refreshed with the changes that
were made to the database. Im not worried about performance right now - I just want hibernate to be completely in sync with my DB. Any ideas ?

Thanks,

Jay
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay,I just realized that didnt make sense.

1) I delete an object.
2) After I delete, I want to refresh my entire application.
3) I create a new session, and close the previous one.
4) The deleted object, although gone from the database, still exists in
a session that was created after it was deleted.

I have tried several perturbations on this pattern (i.e. using flush instead of commit, trying to close the session and then set it to null also before opening a new one, implementation of the Singleton pattern to ensure that multiple sessions arent overwriting each other) to no avail.

I assume there is a high level mistake in my overall architecture that is causing this problem. So I guess the real question is ...

What is the simplest way to run a single hibernate application that is always up to date with the database ?

I'll worry about optimization later. Thanks-j
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic