{"record":{"id":"176ada88f49981ff","repo":"hibernate/hibernate-orm","slug":"not-a-namedselectionmemento-176ada","errorCode":null,"errorMessage":"Not a NamedSelectionMemento","messagePattern":"Not a NamedSelectionMemento","errorType":"exception","errorClass":"IllegalSelectQueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/named/internal/NativeMutationMementoImpl.java","lineNumber":95,"sourceCode":"\t\treturn new NativeQueryImpl( this, session );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic NativeQueryImplementor<T> toQuery(@Nonnull SharedSessionContractImplementor session) {\n\t\treturn toMutationQuery( session );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic <X> NativeQueryImplementor<X> toQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<X> resultType) {\n\t\treturn toMutationQuery( session, resultType );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic <X> NativeQueryImplementor<X> toQuery(@Nonnull SharedSessionContractImplementor session, @Nullable String resultSetMapping) {\n\t\tthrow new IllegalSelectQueryException( \"Not a NamedSelectionMemento\", sqlString );\n\t}\n\n\t@Override\n\tpublic void validate(@Nonnull QueryEngine queryEngine) {\n\t\t// nothing to do\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic NamedNativeQueryMemento<T> makeCopy(@Nonnull String name) {\n\t\treturn new NativeMutationMementoImpl<>( name, this );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic SelectionQueryImplementor<T> toSelectionQuery(@Nonnull SharedSessionContractImplementor session) {\n\t\tthrow new IllegalSelectQueryException( \"Not a NamedSelectionMemento\", sqlString );\n\t}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/named/internal/NativeMutationMementoImpl.java#L77-L113","documentation":"Error \"Not a NamedSelectionMemento\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A named query memento is used as the wrong query kind: Not a NamedSelectionMemento","commonSituations":"Internal mix-up reusing a named selection memento as a mutation memento or vice versa (e.g. via getNamedQuery APIs).","solutions":["The memento is not a NamedSelectionMemento. Use a named selection query instead of a native mutation query."],"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"}