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 are created when {@link #BATCH_FETCH_STYLE} * is defined as {@link org.hibernate.loader.BatchFetchStyle#LEGACY}. * * By default (this setting = `true`) only batch loaders for * {@link org.hibernate.LockMode#READ} and {@link org.hibernate.LockMode#NONE} are * created up front; the others are created as needed. * * `false` indicates that all batch loaders should be created. * * @since 5.3 */ String DELAY_BATCH_LOADER_CREATIONS = "hibernate.loader.delay_batch_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 |
|