{"record":{"id":"28f0e1223409c17d","repo":"hibernate/hibernate-orm","slug":"unknown-memento-type-mementoclass","errorCode":null,"errorMessage":"Unknown memento type: ${mementoClass}","messagePattern":"Unknown memento type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeMutationOrSelectionQueryImpl.java","lineNumber":63,"sourceCode":"\n/**\n * Native query implementation used for the legacy untyped named-query API.\n */\npublic class NativeMutationOrSelectionQueryImpl\n\t\textends NativeQueryImpl<Object>\n\t\timplements MutationOrSelectionQuery {\n\n\tprivate final boolean mutation;\n\n\tpublic static MutationOrSelectionQuery from(NamedNativeQueryMemento<?> memento, SharedSessionContractImplementor session) {\n\t\tif ( memento instanceof NativeSelectionMementoImpl<?> selectionMemento ) {\n\t\t\treturn new NativeMutationOrSelectionQueryImpl( selectionMemento, session );\n\t\t}\n\t\telse if ( memento instanceof NativeMutationMementoImpl<?> mutationMemento ) {\n\t\t\treturn new NativeMutationOrSelectionQueryImpl( mutationMemento, session );\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException( \"Unknown memento type: \" + memento.getClass() );\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean isSelectionQuery() {\n\t\treturn !mutation;\n\t}\n\n\t@Override\n\tpublic boolean isMutationQuery() {\n\t\treturn mutation;\n\t}\n\n\tprivate NativeMutationOrSelectionQueryImpl(\n\t\t\tNativeSelectionMementoImpl<?> selectionMemento,\n\t\t\tSharedSessionContractImplementor session) {\n\t\tsuper( selectionMemento, null, null, session );\n\t\tmutation = false;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeMutationOrSelectionQueryImpl.java#L45-L81","documentation":"Error \"Unknown memento type: ${mementoClass}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A name referenced in the query or its configuration cannot be resolved at runtime.","commonSituations":"Typos in fetch-profile, memento, or table names, or references to objects that were never registered.","solutions":["The memento object passed to the query is of an unknown type; only pass mementos produced by Hibernate's own toMemento() for this query kind.","Recreate the query from the original query string instead of reusing a foreign memento."],"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"}