• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt Regarding Transaction and flush

 
vipul bondugula
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am novice in hibernate. i am having a doubt regarding transactions and flushing..

whenever we want to persist an object we open a session and begin a transaction. after persisting which one of these comes first and the other follows ......

1)session.getTransaction.commit();
2)session.flush()

According to what i have read commit() commits values to the database.
flush() syncs objects state to the database.

what is the difference between these two.....

Thanks & Regards,
vipul kumar.

 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is called during a commit as well, but there can be other scenarios where flush() is required as described here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic