We're updating the issue view to help you get more done. 

Unnecessary initialization of lazy collection on PERSIST cascade

Description

When a PERSIST cascade hits an uninitialized PersistentCollection (PC) on a lazy property, the PC always gets initialized.
This happens even if there are no 'queued actions' associated with the PC.

This seems unnecessary since no potential changes may have been performed on the uninitialized PC or the unloaded Elements.

We noticed this when hunting down superflous SELECT-Statements in the context of performance issues.

Testcase and possible solution will be attached soon

Environment

originally noticed in hibernate 3.51 with postgresql
reproduced with hibernate 5 git master at 2017-07-30 on h2-DB

Status

Assignee

Vlad Mihalcea

Reporter

Jan-Oliver Lustig

Fix versions

backPortable

Backport?

Suitable for new contributors

Yes, likely

Requires Release Note

None

backportDecision

None

Components

Affects versions

3.5.1
5.2.11

Priority

Major