hibernate/hibernate-orm · error · IllegalArgumentException
Global-temp ID tables cannot use AfterUseAction.DROP : ${tem
Error message
Global-temp ID tables cannot use AfterUseAction.DROP : ${temporaryTable.getTableExpression()} What it means
Error "Global-temp 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/GlobalTemporaryTableStrategy.java:53
public static final String SHORT_NAME = "global_temporary";
public static final String CREATE_ID_TABLES = "hibernate.query.mutation_strategy.global_temporary.create_tables";
public static final String DROP_ID_TABLES = "hibernate.query.mutation_strategy.global_temporary.drop_tables";
private final TemporaryTable temporaryTable;
private final SessionFactoryImplementor sessionFactory;
private boolean prepared;
private boolean dropIdTables;
public GlobalTemporaryTableStrategy(TemporaryTable temporaryTable, SessionFactoryImplementor sessionFactory) {
this.temporaryTable = temporaryTable;
this.sessionFactory = sessionFactory;
final TemporaryTableStrategy temporaryTableStrategy = requireGlobalTemporaryTableStrategy( sessionFactory.getJdbcServices().getDialect() );
if ( temporaryTableStrategy.getTemporaryTableAfterUseAction() == AfterUseAction.DROP ) {
throw new IllegalArgumentException( "Global-temp ID tables cannot use AfterUseAction.DROP : "
+ temporaryTable.getTableExpression() );
}
}
protected static TemporaryTableStrategy requireGlobalTemporaryTableStrategy(Dialect dialect) {
return Objects.requireNonNull( dialect.getGlobalTemporaryTableStrategy(),
"Dialect does not define a global temporary table strategy: " + dialect.getClass().getSimpleName() );
}
public TemporaryTableStrategy getTemporaryTableStrategy() {
return castNonNull( sessionFactory.getJdbcServices().getDialect().getGlobalTemporaryTableStrategy() );
}
public void prepare(MappingModelCreationProcess mappingModelCreationProcess, JdbcConnectionAccess connectionAccess) {
if ( prepared ) {
return;
}
View on GitHub (pinned to fad1729dce)
Solutions
- Global temporary tables cannot be dropped per-session; AfterUseAction.DROP is invalid for them.
- Use AfterUseAction.CLEAN or leave cleanup to the database for global 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/2067f83bb213753e.
Report an issue: GitHub.