Could you give me some practical examples that use FlushMode.ALWAYS in Hibernate session?
Thanks,
It's almost always unnecessary. It could be useful if the modifications made in the session cause some modifications when flushed in database, and these modifications can't be detected by Hibernate. For example, if some insert to table A causes a trigger to execute, if this trigger inserts rows to table B, and if you execute a query on table B. In this case, Hibernate can't detect that flushing the session is needed before the HQL query is executed.