• No replies
161 Posts

Pinned topic Controlling query order during Flush in Hibernate

‏2007-05-21T12:37:05Z |
I have a transaction that has more than one query stored internally by hibernate. It contains both updates and inserts. When flush() is called at the end of the transaction I want the queries to be executed in the order in which the session.insert() and session.update() were called. Right now Hibernate is collating all inserts and then all updates and flushing it in insert/update order.

Is there any way we could control Hibernate and specify the order in which the queries are executed? Any other way we could handle this scenario?