hibernate/hibernate-orm · error · IllegalArgumentException
LockMode may not be null
Error message
LockMode may not be null
What it means
Error "LockMode may not be null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/event/spi/RefreshEvent.java:50
);
public RefreshEvent(@Nonnull Object object, @Nonnull EventSource source) {
super(source);
if (object == null) {
throw new IllegalArgumentException("Entity may not be null");
}
this.object = object;
}
public RefreshEvent(@Nullable String entityName, @Nonnull Object object, @Nonnull EventSource source){
this(object, source);
this.entityName = entityName;
}
public RefreshEvent(@Nonnull Object object, @Nonnull LockMode lockMode, @Nonnull EventSource source) {
this(object, source);
if (lockMode == null) {
throw new IllegalArgumentException("LockMode may not be null");
}
this.lockOptions.setLockMode(lockMode);
}
public RefreshEvent(@Nonnull Object object, @Nonnull LockOptions lockOptions, @Nonnull EventSource source) {
this(object, source);
if (lockOptions == null) {
throw new IllegalArgumentException("LockMode may not be null");
}
this.lockOptions = lockOptions;
}
/**
* @deprecated use {@link #RefreshEvent(Object, LockOptions, EventSource)} instead.
*/
@Deprecated(since = "7.0")
public RefreshEvent(@Nullable String entityName, @Nonnull Object object, @Nonnull LockOptions lockOptions, @Nonnull EventSource source){
this(object,lockOptions,source);View on GitHub (pinned to fad1729dce)
Solutions
- Pass a non-null LockMode to the refresh operation, or omit the lock-mode overload entirely.
When it happens
Trigger: Thrown when a caller passes a null LockMode to the API guarded in RefreshEvent.java:50.
Common situations: Typical situations: calling the method with an uninitialized variable; a lookup that returned null being passed straight through; missing null-checks in application code before invoking Hibernate.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/a2d77d1185099f21.
Report an issue: GitHub.