I’ve got a function with a session argument that does various HQL queries and HQL update statements in hibernate. They create sql that goes against alot of tables. All in one transaction.
Now what I want to do is add one entity that this function depends on, in another function, with session.save, and then call the first function. I’m worried that Hiberante won’t cause the SQL associated with the session.save(myentity) before executing the HQL queries and updates that depend on the former. Some kind of caching in the session and reordering of statements.
Andy
The documentation explains pretty well what causes a flush to occur:
I don’t know what your function is doing exactly, and in what order, but the documentation is explicit: executing a query will trigger a flush if required. I’m not sure this applies to bulk updates though (why is why I mentioned the order). But why don’t you flush after the save if you want to be sure?