hibernate/hibernate-orm · error · SemanticException

Assignment referred to columns from multiple tables: ${assig

Error message

Assignment referred to columns from multiple tables: ${assignment.getAssignable()}

What it means

Error "Assignment referred to columns from multiple tables: ${assignment.getAssignable()}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/inline/InlineUpdateHandler.java:139

		// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		// segment the assignments by table-reference
		final Map<TableReference, List<Assignment>> assignmentsByTable = new HashMap<>();
		final List<Assignment> assignments = translation.getSqlAst().getAssignments();
		for ( int i = 0; i < assignments.size(); i++ ) {
			final Assignment assignment = assignments.get( i );
			final List<ColumnReference> assignmentColumnRefs = assignment.getAssignable().getColumnReferences();

			TableReference assignmentTableReference = null;

			for ( int c = 0; c < assignmentColumnRefs.size(); c++ ) {
				final ColumnReference columnReference = assignmentColumnRefs.get( c );
				final TableReference tableReference = resolveTableReference(
						columnReference,
						tableReferenceByAlias
				);

				if ( assignmentTableReference != null && assignmentTableReference != tableReference ) {
					throw new SemanticException( "Assignment referred to columns from multiple tables: " + assignment.getAssignable() );
				}

				assignmentTableReference = tableReference;
			}

			List<Assignment> assignmentsForTable = assignmentsByTable.get( assignmentTableReference );
			if ( assignmentsForTable == null ) {
				assignmentsForTable = new ArrayList<>();
				assignmentsByTable.put( assignmentTableReference, assignmentsForTable );
			}
			assignmentsForTable.add( assignment );
		}
		final List<TableUpdater> tableUpdaters = new ArrayList<>();
		final ExecutionContext executionContext = SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( context );
		getEntityDescriptor().visitConstraintOrderedTables(
				(tableExpression, tableKeyColumnVisitationSupplier) -> {
					final TableUpdater tableUpdater = createTableUpdater(
							tableExpression,

View on GitHub (pinned to fad1729dce)

Solutions

  1. A single UPDATE assignment set columns belonging to multiple tables.
  2. Split the update so each statement assigns columns of one table only.

When it happens

Trigger: An UPDATE/INSERT assignment targets columns that cannot be handled by the mutation strategy.

Common situations: Bulk HQL update/insert statements assigning columns spread across multiple tables or columns of joined associations.


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