{"record":{"id":"2067f83bb213753e","repo":"hibernate/hibernate-orm","slug":"global-temp-id-tables-cannot-use-afteruseaction-dr","errorCode":null,"errorMessage":"Global-temp ID tables cannot use AfterUseAction.DROP : ${temporaryTable.getTableExpression()}","messagePattern":"Global-temp ID tables cannot use AfterUseAction\\.DROP : (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/GlobalTemporaryTableStrategy.java","lineNumber":53,"sourceCode":"\n\tpublic static final String SHORT_NAME = \"global_temporary\";\n\n\tpublic static final String CREATE_ID_TABLES = \"hibernate.query.mutation_strategy.global_temporary.create_tables\";\n\tpublic static final String DROP_ID_TABLES = \"hibernate.query.mutation_strategy.global_temporary.drop_tables\";\n\n\tprivate final TemporaryTable temporaryTable;\n\tprivate final SessionFactoryImplementor sessionFactory;\n\n\tprivate boolean prepared;\n\tprivate boolean dropIdTables;\n\n\tpublic GlobalTemporaryTableStrategy(TemporaryTable temporaryTable, SessionFactoryImplementor sessionFactory) {\n\t\tthis.temporaryTable = temporaryTable;\n\t\tthis.sessionFactory = sessionFactory;\n\t\tfinal TemporaryTableStrategy temporaryTableStrategy = requireGlobalTemporaryTableStrategy( sessionFactory.getJdbcServices().getDialect() );\n\n\t\tif ( temporaryTableStrategy.getTemporaryTableAfterUseAction() == AfterUseAction.DROP ) {\n\t\t\tthrow new IllegalArgumentException( \"Global-temp ID tables cannot use AfterUseAction.DROP : \"\n\t\t\t\t\t\t\t\t\t\t\t\t+ temporaryTable.getTableExpression() );\n\t\t}\n\t}\n\n\tprotected static TemporaryTableStrategy requireGlobalTemporaryTableStrategy(Dialect dialect) {\n\t\treturn Objects.requireNonNull( dialect.getGlobalTemporaryTableStrategy(),\n\t\t\t\t\"Dialect does not define a global temporary table strategy: \" + dialect.getClass().getSimpleName() );\n\t}\n\n\tpublic TemporaryTableStrategy getTemporaryTableStrategy() {\n\t\treturn castNonNull( sessionFactory.getJdbcServices().getDialect().getGlobalTemporaryTableStrategy() );\n\t}\n\n\tpublic void prepare(MappingModelCreationProcess mappingModelCreationProcess, JdbcConnectionAccess connectionAccess) {\n\t\tif ( prepared ) {\n\t\t\treturn;\n\t\t}\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/GlobalTemporaryTableStrategy.java#L35-L71","documentation":"Error \"Global-temp ID tables cannot use AfterUseAction.DROP : ${temporaryTable.getTableExpression()}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An API operation is invoked on a query object that does not support it.","commonSituations":"Calling query hint, locking, pagination, conversion, or mutation APIs on a query kind (native vs HQL, select vs mutation) that does not implement them.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}