public class SqlServerForeignKeyLockingEvent extends EntityMappingEvent
SqlServerForeignKeyLockingEvent indicates that an entity contains
ManyToOne associations or
non-shared OneToOne associations, without the entity being
configured to use DynamicUpdate.
By default, Hibernate includes all non-id entity columns in the SET clause of an UPDATE statement,
and, for this reason, on SQL Server, a shared lock is acquired on the parent table record
to ensure that the Foreign Key is not going to reference a non-existing parent row.
So, to reduce the likelihood of locking and deadlocks, you are better off setting
DynamicUpdate on such entities.Event.Priority| Constructor and Description |
|---|
SqlServerForeignKeyLockingEvent(Class entityClass,
int manyToOneAssociationCount,
int oneToOneAssociationCount)
Instantiate the event using the provided parameters.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDescription()
|
int |
getManyToOneAssociationCount()
Get the number of many-to-one associations that can be affected by the Foreign Key locking issue.
|
int |
getOneToOneAssociationCount()
Get the number of one-to-one associations that can be affected by the Foreign Key locking issue.
|
Event.Priority |
getPriority()
Get the
Event.Priority of this Event |
getEntityClass, getEntityNamegetInfoUrlpublic SqlServerForeignKeyLockingEvent(Class entityClass, int manyToOneAssociationCount, int oneToOneAssociationCount)
entityClass - entity classmanyToOneAssociationCount - many-to-one associations that can be affected by the Foreign Key locking issueoneToOneAssociationCount - one-to-one associations that can be affected by the Foreign Key locking issuepublic int getManyToOneAssociationCount()
public int getOneToOneAssociationCount()
public Event.Priority getPriority()
Event.Priority of this EventEvent.Priority of this EventCopyright © 2026. All rights reserved.