hibernate/hibernate-orm · error · NullPointerException

null copies are not supported by

Error message

null copies are not supported by 

What it means

Error "null copies are not supported by " thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/event/spi/MergeContext.java:135

	 */
	public boolean containsKey(@Nonnull Object mergeEntity) {
		if ( mergeEntity == null ) {
			throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
		}
		return mergeToManagedEntityXref.containsKey( mergeEntity );
	}

	/**
	 * Returns true if this MergeContext contains a cross-reference from the specified managed entity
	 * to a merge entity.
	 * @param managedEntity must be non-null
	 * @return true if this MergeContext contains a cross-reference from the specified managed entity
	 * to a merge entity
	 * @throws NullPointerException if managedEntity is null
	 */
	public boolean containsValue(@Nonnull Object managedEntity) {
		if ( managedEntity == null ) {
			throw new NullPointerException( "null copies are not supported by " + getClass().getName() );
		}
		return managedToMergeEntityXref.containsKey( managedEntity );
	}

	/**
	 * Returns an unmodifiable set view of the merge-to-managed entity cross-references contained in this MergeContext.
	 * @return an unmodifiable set view of the merge-to-managed entity cross-references contained in this MergeContext
	 *
	 * @see Collections#unmodifiableSet(Set)
	 */
	public @Nonnull Set<Map.Entry<Object,Object>> entrySet() {
		return Collections.unmodifiableSet( mergeToManagedEntityXref.entrySet() );
	}

	/**
	 * Returns the managed entity associated with the specified merge Entity.
	 * @param mergeEntity the merge entity; must be non-null
	 * @return  the managed entity associated with the specified merge Entity

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not register null managed copies in the merge context; ensure merge always produces a non-null copy.

When it happens

Trigger: Thrown when a null key or value is put into the merge-to-managed mapping of a MergeContext.

Common situations: Typical situations: merging a graph containing null elements; cascade-merge reaching a null association or collection element.


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