hibernate/hibernate-orm · error · ParsingException
Unsupported pad specification [{ctx.getText()}]
Error message
Unsupported pad specification [{ctx.getText()}] What it means
Error "Unsupported pad specification [{ctx.getText()}]" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:5502
ctx.padCharacter() != null
? visitPadCharacter( ctx.padCharacter() )
: null;
return getFunctionDescriptor("pad").generateSqmExpression(
padChar != null
? asList( source, length, padSpec, padChar )
: asList( source, length, padSpec ),
null,
queryEngine()
);
}
@Override
public SqmTrimSpecification visitPadSpecification(HqlParser.PadSpecificationContext ctx) {
final var symbol = ((TerminalNode) ctx.getChild( 0 )).getSymbol();
return switch ( symbol.getType() ) {
case HqlParser.LEADING -> new SqmTrimSpecification( TrimSpec.LEADING, nodeBuilder() );
case HqlParser.TRAILING -> new SqmTrimSpecification( TrimSpec.TRAILING, nodeBuilder() );
default -> throw new ParsingException( "Unsupported pad specification [" + ctx.getText() + "]" );
};
}
@Override
public SqmLiteral<Character> visitPadCharacter(HqlParser.PadCharacterContext ctx) {
final String padCharText = ctx.STRING_LITERAL().getText();
if ( padCharText.length() != 3 ) {
throw new SemanticException( "Pad character for pad() function must be single character, found '"
+ padCharText + "'",
query );
}
return new SqmLiteral<>(
padCharText.charAt( 1 ),
nodeBuilder().getCharacterType(),
nodeBuilder()
);
}
View on GitHub (pinned to fad1729dce)
Solutions
- The pad specification is not supported. Use LEADING or TRAILING in the pad() function call.
When it happens
Trigger: An invalid keyword/field is used in a datetime, pad, or trim expression: Unsupported pad specification [<value>]
Common situations: HQL queries using extract(), pad(), or trim() with a field/specification keyword that is not one of the documented values.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/623b5abad6e5a136.
Report an issue: GitHub.