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

Perfomance issue with ElementCollection

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.7
    • Fix Version/s: 5.0.7, 5.1.0
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      We have issue with perfomance of updating map collection under heavy load. Our collection mapping:

      @ElementCollection
      @MapKeyJoinColumn( name = "poi", nullable = false )
      @JoinTable( name = "mon_race_poi_arrival",
      joinColumns =

      { @JoinColumn( name = "workday", nullable = false, referencedColumnName = "workday" ), @JoinColumn( name = "date_execute", nullable = false, referencedColumnName = "dateExecute" ), @JoinColumn( name = "race_number", nullable = false, referencedColumnName = "raceNumber" ) }

      )
      private Map<Poi, PoiArrival> poiArrival;

      For workarounding HHH-7072 Closed you are always recreate collection if there is no not null property in collection element (methods org.hibernate.action.internal.CollectionUpdateAction#execute and org.hibernate.collection.internal.AbstractPersistentCollection#needsRecreate).

      But if there is indexed collection (list or map), this recreation can be avoided, because index property is usualy is not null, and it is used in where condition for updates instead of element values.

      Fixing this can be easy - just override method needsRecreate in PersistentMap and PersistentList, like you are already do in PersistentBag.
      Or rewrite common method in AbstractPersistentCollection to check nullability of index column.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: