We have a lot of {{LockMode}} s and we load an {{EntityLoader}} per {{LockMode}} which consumes quite a lot of memory.
We should lazy load them so that we don't create objects for all the {{LockMode}} s even if they are not used by the application.
Also adds the following setting to control whether these creations are delayed or done immediately:
{code} /** * Controls how the individual Loaders for an entity are created when {@link #BATCH_FETCH_STYLE} * is defined as {@link org . hibernate.loader.BatchFetchStyle#LEGACY}. * * By default (this setting = When `true` (the default ) , only batch loaders for the minimal set of Loaders are * created. These include the handling for {@link org.hibernate.LockMode#READ} * and {@link org.hibernate.LockMode#NONE} are as well as specialized Loaders for * created up front; the others are created as needed merge and refresh handling . * * `false` indicates that all batch loaders should be created . up front * * @since 5.3 */ String DELAY_BATCH_LOADER_CREATIONS DELAY_ENTITY_LOADER_CREATIONS = "hibernate.loader. delay_batch_loader_creations delay_entity_loader_creations "; {code}
This is a follow-up of this forum post: https://discourse.hibernate.org/t/batch-fetch-style-recommendations/631 and this discussion on the mailing list http://lists.jboss.org/pipermail/hibernate-dev/2018-May/017599.html and http://lists.jboss.org/pipermail/hibernate-dev/2018-May/017635.html.
Also |
|