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 the use of 'super' keyword inside a constructor?

539


What is the java idl system?

557


Is string pool garbage collected?

522


What is functional interface in java example?

510


What lambda means?

519






What do you mean by data type?

521


Explain public static void main(string args[]) in java.

513


What are recursive functions? Give some examples?

594


What is java virtual machine? Explain

543


what is abstract class in Java?

619


How many bytes are a float?

488


Is alive method in java?

479


What is string in java with example?

464


What is the difference between an object-oriented programming language and object-based programming language?

542


How do I convert a string to an int in java?

526