It would be really helpful if when a StaleStateException is thrown from Expectations.BasicExpectation that the statement can be included in the error message. The information is available in the parameter 'PreparedStatement statement'.
Currently the error thrown is:
But it could be:
I see a similar change was made https://github.com/hibernate/hibernate-orm/commit/f18656473dc3112c76240a6c3f47a5050608de75#diff-0