Preface: This question is a derivative of this answer, speaking specifically about NHibernate
instead of Hibernate
.
As to Hibernate, javadoc to org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(EventSource) says:
Execute all SQL and second-level cache updates, in a special order so that foreign-key constraints cannot be violated:
- Inserts, in the order they were performed
- Updates Deletion of collection elements
- Insertion of collection elements
- Deletes, in the order they were performed
My Questions:
- If it applies to Hibernate, does this order apply to NHibernate too?
- Is this deterministic order documented somewhere?
Also - If this behavior is DBMS-specific, I'm using SQL Server.