• 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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!