According to NHibernate documentation, SQL statements are issued in the following order when a session is flushed:
Why is it forced in this order and is there any way to change it so that the statements are executed in the same order that I give them?
It's in that order because it's the safest.
And no, you can't change the order. But also, you never gave NHibernate any order: you just mark entities for persistence; NHibernate determines what to do automatically.
If you think you need more control over individual SQL operations, you can use IStatelessSession
instead of a regular ISession
. You lose all the stuff NH does automatically (lazy loading, caching, dirty-tracking), but you can (must) say explicitly when to Insert
, Delete
or Update
a record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With