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 vector in java?

780


Write the algorithm to check the number non-leaf nodes in a tree.

840


How many digits is int32?

726


How does arraylist work in java?

767


Can there be an abstract method without an abstract class?

720


Explain about public and private access specifiers?

769


What is difference between iterator access and index access?

844


How do you clear an arraylist in java?

699


What do you understand by garbage collection in Java? Can it be forced to run?

751


What is jit compiler ?

770


What causes memory leaks in java?

665


What is difference between path and classpath?

772


Why are functions called methods in java?

748


Write a program to reverse a number in java?

783


How will you add panel to a frame?

854