About the order of SQL execution when flushing to the database

I don’t remember proposing a “flush method call that really makes sense” … I just do not agree that calling flush manually is always a code smell, and do not agree that using update in place of delete and insert is always the best option.

In fact, the discussion around manual flush smells was divergent to my goal when creating this topic:

I just want to understand the reason behind Hibernate’s flush order, which “was chosen to minimize the chances of constraint violations”.

Put simply: no evidence of Hibernate’s flush order avoiding constraint violations was presented yet. This evidence must show Java code, and the corresponding SQL, the latter ordered as per Hibernate’s flush order and avoiding a constraint violation that would occur if the SQL was flushed as per change order.

Please, lets focus on this, and forget the side-talk of code smells.