hibernate/hibernate-orm · error · UnsupportedOperationException
No support for retrieving previous value
Error message
No support for retrieving previous value
What it means
Error "No support for retrieving previous value" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java:64
* @param sequenceName the name of the sequence
* @return The "next value" fragment.
* @throws MappingException If sequences are not supported.
*/
String getSelectSequenceNextValString(String sequenceName) throws MappingException;
/**
* Generate the select expression fragment that will retrieve the previous
* value of a sequence as part of another (typically DML) statement.
* <p>
* This differs from {@link #getSequencePreviousValString(String)} in that
* it must return an expression usable within another statement.
*
* @param sequenceName the name of the sequence
* @return The "previous value" fragment.
* @throws MappingException If sequences are not supported.
*/
default String getSelectSequencePreviousValString(String sequenceName) throws MappingException {
throw new UnsupportedOperationException( "No support for retrieving previous value" );
}
/**
* Generate the appropriate select statement to to retrieve the next value
* of a sequence.
* <p>
* This should be a stand alone select statement.
*
* @param sequenceName the name of the sequence
* @return String The select "next value" statement.
* @throws MappingException If sequences are not supported.
*/
default String getSequenceNextValString(String sequenceName) throws MappingException {
return "select " + getSelectSequenceNextValString( sequenceName ) + getFromDual();
}
/**
* Generate the appropriate select statement to to retrieve the previous valueView on GitHub (pinned to fad1729dce)
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
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/ba1ad13a26a48fa4.
Report an issue: GitHub.