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

Flushed session in Hibernate - what does it do?

 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have an object that is not detached from the session. When I close the session, I see the following line in the logs:

AbstractFlushingEventListener:85 - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects

What does that mean? Why does it have the 1 objects in the line?

It only happens for the one object. Other log traces put:

AbstractFlushingEventListener:85 - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects

The reason I ask is because we're getting locks in the first example - so it's clearly doing something on the database.

Any help is much appreciated.

Cheers,

Steve
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The goal of the flush mechanism of Hibernate is to sychronize the state of your persistent objects that are in the session with the database.
Basically you can have a persistent oject in in your hibernate sesion.
If you change its state, the state will not reflect the database content anymore.
On the flush hibernate synchronizes the database with the new state of your object.

hope it will help.
[ October 28, 2008: Message edited by: ntumba lobo ]
 
paramita saha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far I know,Flush is used to synchronize the state of persistent onject to database.In fact, there can be different Flush modes which includes FLUSH.NONE,FLUSH.AUTO,FLUSH.COMMIT.As the name suggests, when FLUSH.NONE is set ,developer have to call flush explicitly,on Flush.AUTO, flush is executed before every query and on FLUSH.COMMIT,flush is executed before every database updation...that's all i know about flush..hope this information will be helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic