Right now, we only support batching a single statement, but especially with locking which should IMO also be batched, it is desirable to support multiple open batches. Locking in general is a bit clumsy right now. We have post-load hooks and Callback for upgrading lock modes, but these all feel a bit ad-hoc to me. Since Callback is only used for locking anyway, I think we should re-model this into a more general purpose solution that also allows batching. The idea for this came from https://github.com/hibernate/hibernate-orm/pull/7063 |