NullPointerException on lazy load of non-existed entity outside transaction

Description

NullPointerException occurs when I try to access a lazy-loading field on non-existent entity outside the transaction (ENABLE_LAZY_LOAD_NO_TRANS=true). As the result, I get LazyInitializationException with null message. If the same is done inside the transaction then the correct exception will be thrown (ObjectNotFoundException) and the correct message will be given (No row with the given identifier exists).

I made github PR with a test and a possible fix.

Environment

None

Status

Assignee

Unassigned

Reporter

Nick Golubev

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.2.3

Priority

Major