Quote:
I am not sure why we need to open the Transaction API for the commit
Can someone help me out to understand this
The flush operation is not the same as commit as it does not terminate the transaction!
Each transaction must be terminated either by commit or a rollback call.
If you never call commit or rollback then sooner or later (it depends on your db-config)
your transaction with go in timeout and your database will rollback the transaction implicitly.
Only with the commit call the updated/changed data gets definitely consolidated on the db.
Furthermore with ReadCommited isolation level (or higher) the commit call is also the moment where
the changed data gets visible to other transactions.