hibernate/hibernate-orm · error · IllegalArgumentException
Entity may not be null
Error message
Entity may not be null
What it means
Error "Entity may not be null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/event/spi/EvictEvent.java:25
/**
* Event class for {@link org.hibernate.Session#evict}
* and {@link org.hibernate.Session#detach}.
*
* @author Steve Ebersole
*
* @see org.hibernate.Session#evict
* @see org.hibernate.Session#detach
*/
public class EvictEvent extends AbstractSessionEvent {
private Object object;
public EvictEvent(@Nonnull Object object, @Nonnull EventSource source) {
super(source);
if (object == null) {
throw new IllegalArgumentException( "Entity may not be null" );
}
this.object = object;
}
@Nonnull
public Object getObject() {
return object;
}
public void setObject(@Nonnull Object object) {
this.object = object;
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Check the entity argument for null before constructing an EvictEvent / calling Session.evict().
When it happens
Trigger: Thrown when a caller passes a null Entity to the API guarded in EvictEvent.java:25.
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/ed183d0e9c2a51a8.
Report an issue: GitHub.