hibernate/hibernate-orm · error · ModelsException
Multiple callback methods for callback type '@
Error message
Multiple callback methods for callback type '@%s' and parameter type '%s' in listener class '%s'
What it means
Two callback methods in the same listener class claim the same callback type and entity parameter type, so only one could be registered. Remove or rename one of the duplicate @PreX/@PostX methods listed in the message.
Solutions
- Keep a single callback method per lifecycle event type (and parameter type) in the listener/callback class; merge the logic of the duplicates.
Example fix
Keep a single callback method per lifecycle event type (and parameter type) in the listener/callback class; merge the logic of the duplicates.
Defensive patterns
Strategy: validation
When it happens
Trigger: A JPA entity-listener or lifecycle callback violates the callback contract.
Common situations: Listener classes with missing lifecycle annotations, wrong method signatures, or multiple methods for the same event type.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/cdda280dc0453292.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java:612
+ signatureRequirement( JpaEventListenerStyle.LISTENER ) );
}
if ( firstParameterType( methodDetails )
.isAssignableFrom( targetClassDetails.toJavaClass() ) ) {
addIfAbsent( listenerClassDetails, callbackType, methodDetails, descriptors );
}
}
}
private static void addIfAbsent(
ClassDetails listenerClassDetails,
CallbackType callbackType,
MethodDetails methodDetails,
List<LifecycleEventHandler> descriptors) {
for ( var existing : descriptors ) {
final var existingMethod = existing.getCallbackMethod( callbackType );
if ( existingMethod != null && existingMethod != methodDetails
&& Objects.equals( firstParameterType( existingMethod ), firstParameterType( methodDetails ) ) ) {
throw new ModelsException(
"Multiple callback methods for callback type '@"
+ callbackType.getCallbackAnnotation().getSimpleName()
+ "' and parameter type '" + firstParameterType( methodDetails ).getSimpleName()
+ "' in listener class '" + listenerClassDetails.getClassName() + "'" );
}
}
descriptors.add( withCallbackMethod( listenerClassDetails, callbackType, methodDetails ) );
}
private static Class<?> firstParameterType(MethodDetails first) {
return first.getArgumentTypes().get( 0 ).toJavaClass();
}
private static LifecycleEventHandler withCallbackMethod(
ClassDetails listenerClassDetails,
CallbackType callbackType,
MethodDetails methodDetails) {
final EnumMap<CallbackType, MethodDetails> callbackMethods = new EnumMap<>( CallbackType.class );View on GitHub (pinned to fad1729dce)