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

Is java still necessary?

631


Is empty .java file name a valid source file name?

595


State the significance of public, private, protected class?

658


What does singleton class mean?

547


How do you replace all in word?

539






What's the purpose of using break in each case of switch statement?

518


Why do we use return statement?

553


What is a void in java?

592


What is parsing a string?

601


What is var keyword ?

744


What is finally in Java?

590


Is empty in java?

588


What is difference between array and arraylist in java?

468


What is the concatenation operator in java?

584


What are the main features of java?

536