hibernate/hibernate-orm · error · ModelsException

Multiple callback methods for callback type '@%s' and parame

Error message

Multiple callback methods for callback type '@%s' and parameter type '%s' in listener class '%s'

What it means

Error "Multiple callback methods for callback type '@%s' and parameter type '%s' in listener class '%s'" thrown in hibernate/hibernate-orm.

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)

Solutions

  1. 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.

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.