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
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.
|