Uploaded image for project: 'Hibernate ORM'
  1. HHH-12558

Lazy load EntityLoaders to improve memory usage

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3.0.Final
    • Component/s: hibernate-core
    • Labels:
      None

      Description

      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:

      	
      	/**
      	 * Controls how the individual Loaders for an entity are created.
      	 *
      	 * When `true` (the default), only the minimal set of Loaders are
      	 * created.  These include the handling for {@link org.hibernate.LockMode#READ}
      	 * and {@link org.hibernate.LockMode#NONE} as well as specialized Loaders for
      	 * merge and refresh handling.
      	 *
      	 * `false` indicates that all loaders should be created up front
      	 *
      	 * @since 5.3
      	 */
      	String DELAY_ENTITY_LOADER_CREATIONS = "hibernate.loader.delay_entity_loader_creations";
      

      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

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                gsmet Guillaume Smet
                Reporter:
                gsmet Guillaume Smet
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: