StaleStateException does not log out the stale object or the statement that was executed

Description

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

Environment

None

Activity

Show:
Mickaël TRICOT
April 4, 2020, 1:46 AM

Hello, I have a problem with this (nice) improvement: some sensible data are leaking in my logs. Do you think that could be an option to add the statement conditionnaly, for instance only when hibernate.show_sql=true ? Thanks

Mickaël TRICOT
April 4, 2020, 2:26 AM

I created for that

Fixed

Assignee

Daniel Smith

Reporter

Frank Sloan

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Minor