# Flushing - COBOL and Save Points

Flushing means writing the changes to the database. It syncs the database with the session cache. Flushing is expensive but necessary to maintain data integrity. The system flushes under the following conditions:

- Before commit

- Before raw SQL queries

- Before most HQL queries

- When specifically requested

- Savepoints

Parent topic: Object-Relational Mapping: Background