This is a
very rare deadlock that can occur on some databases.Difference databases have different conflict resolution, and different
deadlock avoidance and detection.In
most cases it might make sense to allow the database to handle this rare possibility,
than requiring the sort overhead on all updates from JPA.There is a persistence unit option for it,
so it is very easy to enable for the entire application.Application servers are free to choose their
own defaults, so could enable this if they choose in the persistence unit
properties they pass EclipseLink.

EclipseLink
actually ends up partial ordering updates without this setting, as the object
changes sets are hash ordered by primary key.Because of this, it is quite difficult to reproduce this deadlock even
when trying very hard.