JQPL query hydrates the entity with lazy collection

Thanks @beikov . After incorporating the above change, when I debug now, I can see the above collection as uninitialized.

But in the logs we are seeing intermitent N calls to Configs when I fetch the ConfigContainer by type and perform getImmutableConfigs() on it.

ConfigContainer cc =. getConfigContainerByType(configType);
cc.getImmutableConfigs();

This is happening after we upgraded Hibernate version from 5.2.4.Final to 5.4.27.Final due to CVE. A pom.xml file change. We made the following changes:

We kept Hibernate-validator at 5.2.4.Final
and upgraded hibernate-core, hibernate-entitymanager, hibernate-c3p0, hibernate-ehcache, hibernate-envers to 5.4.27.Final
We kept the hibernate-jpa-2.1-api at 1.0.0.Final

Hibernate 5.2.4.Final: (Only two SQLs)

select ... from CONFIG_CONTAINER where configType=?
select ... from CONFIG where  CONFIG_CONTAINER_ID=?

Hibernate 5.4.27.Final: (N calls to Configs)

select ... from CONFIG_CONTAINER where  CONFIG_TYPE=?

select ... from CONFIG where CONFIG_ID=?
.
.
N Calls to configs
.
select ... from CONFIG where CONFIG_ID=?

These entities and few others similar to these ones are hotspots in our code and are executed numerous times. After upgradation, wee are observing slowness.

We are wondering what changed from 5.2 → 5.4 ? Any guidance would be really helpful!
Currently we are upgrading to 5.3 to check whether we the performance issuee or not.

If this can’t be answered here then I will raise a separate post.