hibernate/hibernate-orm · error · IllegalArgumentException

Persistent ID tables cannot use AfterUseAction.DROP : ${temp

Error message

Persistent ID tables cannot use AfterUseAction.DROP : ${temporaryTable.getTableExpression()}

What it means

Error "Persistent ID tables cannot use AfterUseAction.DROP : ${temporaryTable.getTableExpression()}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/PersistentTableStrategy.java:60

	public static final String SCHEMA = "hibernate.query.mutation_strategy.persistent.schema";

	public static final String CATALOG = "hibernate.query.mutation_strategy.persistent.catalog";

	private final TemporaryTable temporaryTable;
	private final SessionFactoryImplementor sessionFactory;

	private boolean prepared;

	private boolean dropIdTables;

	public PersistentTableStrategy(
			TemporaryTable temporaryTable,
			SessionFactoryImplementor sessionFactory) {
		this.temporaryTable = temporaryTable;
		this.sessionFactory = sessionFactory;

		if ( sessionFactory.getJdbcServices().getDialect().getPersistentTemporaryTableStrategy().getTemporaryTableAfterUseAction() == AfterUseAction.DROP ) {
			throw new IllegalArgumentException( "Persistent ID tables cannot use AfterUseAction.DROP : " + temporaryTable.getTableExpression() );
		}
	}

	public TemporaryTableStrategy getTemporaryTableStrategy() {
		return castNonNull( sessionFactory.getJdbcServices().getDialect().getPersistentTemporaryTableStrategy() );
	}

	public void prepare(
			MappingModelCreationProcess mappingModelCreationProcess,
			JdbcConnectionAccess connectionAccess) {
		if ( prepared ) {
			return;
		}

		prepared = true;

		final ConfigurationService configService =
				mappingModelCreationProcess.getCreationContext()

View on GitHub (pinned to fad1729dce)

Solutions

  1. Persistent ID tables are shared and cannot be dropped after use; AfterUseAction.DROP is invalid.
  2. Use AfterUseAction.CLEAN for persistent temporary tables.

When it happens

Trigger: An API operation is invoked on a query object that does not support it.

Common situations: Calling query hint, locking, pagination, conversion, or mutation APIs on a query kind (native vs HQL, select vs mutation) that does not implement them.


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