hibernate/hibernate-orm · error · HibernateException

bad number of accessors

Error message

bad number of accessors

What it means

Error "bad number of accessors" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/bytecode/internal/bytebuddy/BytecodeProviderImpl.java:382

			c = c.getSuperclass();
		}
		return bridgeMembersClassInfos;
	}

	public ByteBuddyProxyHelper getByteBuddyProxyHelper() {
		return byteBuddyProxyHelper;
	}

	private static void findAccessors(
			Class<?> clazz,
			String[] getterNames,
			String[] setterNames,
			Class<?>[] types,
			Method[] getters,
			Method[] setters) {
		final int length = types.length;
		if ( setterNames.length != length || getterNames.length != length ) {
			throw new HibernateException( "bad number of accessors" );
		}

		final Class<?>[] getParam = new Class[0];
		for ( int i = 0; i < length; i++ ) {
			if ( getterNames[i] != null ) {
				final Method getter = findAccessor( clazz, getterNames[i], getParam );
				if ( getter.getReturnType() != types[i] ) {
					throw new HibernateException( "wrong return type: " + getterNames[i] );
				}

				getters[i] = getter;
			}

			if ( setterNames[i] != null ) {
				setters[i] = ReflectHelper.setterMethodOrNullBySetterName( clazz, setterNames[i], types[i] );
				if ( setters[i] == null ) {
					throw new HibernateException(
							String.format(

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure every persistent property has a matching getter/setter pair with consistent types; check for misnamed accessors after refactoring.

Example fix

Ensure every persistent property has a matching getter/setter pair with consistent types; check for misnamed accessors after refactoring.

When it happens

Trigger: Bytecode enhancement, proxy creation, or lazy interception is applied to an incompatible class or configuration.

Common situations: Build-time enhancement with module-system restrictions, mismatched Hibernate versions between build and runtime, or hibernate.bytecode.provider=none with a model that needs proxies.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/e197e9ffe942f99a. Report an issue: GitHub.