{"record":{"id":"ba1ad13a26a48fa4","repo":"hibernate/hibernate-orm","slug":"no-support-for-retrieving-previous-value","errorCode":null,"errorMessage":"No support for retrieving previous value","messagePattern":"No support for retrieving previous value","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java","lineNumber":64,"sourceCode":"\t * @param sequenceName the name of the sequence\n\t * @return The \"next value\" fragment.\n\t * @throws MappingException If sequences are not supported.\n\t */\n\tString getSelectSequenceNextValString(String sequenceName) throws MappingException;\n\n\t/**\n\t * Generate the select expression fragment that will retrieve the previous\n\t * value of a sequence as part of another (typically DML) statement.\n\t * <p>\n\t * This differs from {@link #getSequencePreviousValString(String)} in that\n\t * it must return an expression usable within another statement.\n\t *\n\t * @param sequenceName the name of the sequence\n\t * @return The \"previous value\" fragment.\n\t * @throws MappingException If sequences are not supported.\n\t */\n\tdefault String getSelectSequencePreviousValString(String sequenceName) throws MappingException {\n\t\tthrow new UnsupportedOperationException( \"No support for retrieving previous value\" );\n\t}\n\n\t/**\n\t * Generate the appropriate select statement to to retrieve the next value\n\t * of a sequence.\n\t * <p>\n\t * This should be a stand alone select statement.\n\t *\n\t * @param sequenceName the name of the sequence\n\t * @return String The select \"next value\" statement.\n\t * @throws MappingException If sequences are not supported.\n\t */\n\tdefault String getSequenceNextValString(String sequenceName) throws MappingException {\n\t\treturn \"select \" + getSelectSequenceNextValString( sequenceName ) + getFromDual();\n\t}\n\n\t/**\n\t * Generate the appropriate select statement to to retrieve the previous value","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java#L46-L82","documentation":"Error \"No support for retrieving previous value\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not call getPreviousValue() on a dialect that cannot retrieve previous sequence values; use select next value semantics instead","Provide an explicit initial value instead of asking the database for the previous value","Override getPreviousValueSupport in a custom dialect if the target database supports it"],"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"}