hibernate/hibernate-orm · error · HibernateException

Unable to deserialize proxy

Error message

Unable to deserialize proxy [%s, %s]; could not locate id setter method [%s] on entity class [%s]

What it means

Deserialization guard in resolveIdSetterMethod: the identifier setter method recorded in the SerializableProxy cannot be found on the entity class via getDeclaredMethod (NoSuchMethodException), so the proxy's id cannot be restored. Usually the entity class changed after serialization; the faulty input is the recorded setter signature.

Solutions

  1. Define an id setter matching the mapped identifier property on the entity class.
  2. Check that the identifier property access type is consistent.
Defensive patterns

Strategy: validation

When it happens

Trigger: A name referenced in a mapping, query, or configuration cannot be resolved at runtime.

Common situations: Typos in entity/attribute/mapping names, missing mappings, or refactoring without updating references.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java:168

							serializableProxy.getIdentifierGetterMethodName(),
							serializableProxy.getIdentifierGetterMethodClass()
					)
			);
		}
	}

	private static Method resolveIdSetterMethod(SerializableProxy serializableProxy) {
		if ( serializableProxy.getIdentifierSetterMethodName() == null ) {
			return null;
		}

		try {
			return serializableProxy.getIdentifierSetterMethodClass()
					.getDeclaredMethod( serializableProxy.getIdentifierSetterMethodName(),
							serializableProxy.getIdentifierSetterMethodParams() );
		}
		catch (NoSuchMethodException e) {
			throw new HibernateException(
					String.format(
							Locale.ENGLISH,
							"Unable to deserialize proxy [%s, %s]; could not locate id setter method [%s] on entity class [%s]",
							serializableProxy.getEntityName(),
							serializableProxy.getId(),
							serializableProxy.getIdentifierSetterMethodName(),
							serializableProxy.getIdentifierSetterMethodClass()
					)
			);
		}
	}
}

View on GitHub (pinned to fad1729dce)