• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Flushed session in Hibernate - what does it do?

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic