• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate session in JBoss

 
Abhijit Das
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using hibernate in JBoss server. whenever i try to save or modify data, I call the hibernate session.flush(). but in case of stand alone java application i create the transaction object and call transaction.commit() to save or update any hibernate DTO. what is the basic difference between calling transaction.commit() and sassion.flush(). how the rollback takes place in case of session.flush()?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, these methods do different things and are pretty much unrelated.

transaction.commit()

is a call to commits all inserts/updates/deletes within a transaction.

session.flush()

is a call to force the session to synchronise with the database in its current state.

Flushing the session will not necesarily make any changes to the database.

Have a read of this Hibernate Wiki to find out more.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic