Difference between flush() and commit() in hibernate?

Answer Posted / aslam mohammed c l

Flushing the Session simply makes the data that is currently
in the session synchronized with what is in the database.
However, just because you have flushed, doesn't mean the
data can't be rolled back.

Commit does flush the session, but it also ends the unit of
work.

To summarize commit does two things,

1. Commit internally does flush
2. Ends the unit of work (makes the changes permanent).

Is This Answer Correct ?    21 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a nested class?

594


What is string data type?

554


Explain about wait() method?

568


When is the finalize() called? What is the purpose of finalization?

580


Does java support multiple inheritances?

558






What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

516


What are the rules for naming an array?

525


What is difference between path and classpath in java?

485


What is final class?

577


What is default locale java?

536


What does escaping a character mean?

531


How can you read content from file in java?

597


How will you load a specific locale?

536


what is method reference in java 8?

553


What is jrmp?

547