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

Answers were Sorted based on User's Feedback

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

Answer / 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

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

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

Answer / ijaz ahmed

Great answer!

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More Core Java Interview Questions

Can we declare an anonymous class as both extending a class and implementing an interface?

8 Answers   TCS, Wipro, JVA, College School Exams Tests,

Difference between object and reference?

0 Answers  

What is garbage collection? What is the process that is responsible for doing that in java?

0 Answers  

Can we write any code after throw statement?

0 Answers  

What are null interfaces? Give some examples?

2 Answers  

describe synchronization in respect to multithreading? : Java thread

0 Answers  

When the constructor of a class is invoked?

0 Answers  

what is the use of private constructor in core java?

3 Answers   Satyam, Yash Technologies, OnMobile,

What do you know about the garbage collector in java?

0 Answers   TCS,

What is diffrance between FINALIZE() & FINALLY ?

2 Answers   Infosys,

what is difference Between Core Java and advance java

60 Answers   HP, TCS, HCL, Wipro, Sambalpur University, Vensai Technologies,

Name the package that most of the AWT events that supports event-delegation model are defined?

2 Answers