Improved error output for LazyInitializationException to include entity-related info

Description

AbstractLazyInitializer.initialize() can throw LazyInitializationExceptions:

1 2 3 4 5 6 7 8 9 10 11 if (this.session == null) { throw new LazyInitializationException("could not initialize proxy - no Session"); } if (!this.session.isOpen()) { throw new LazyInitializationException("could not initialize proxy - the owning Session was closed"); } if (!this.session.isConnected()) { throw new LazyInitializationException("could not initialize proxy - the owning Session is disconnected"); }

I think it would greatly make debugging easier when entityName and ID of the entity would be included in all lazyinitialization exception messages to give a clue in the right direction.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Niko Wittenbeck

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

4.3.11
5.2.16

Priority

Minor