{"record":{"id":"808aa141103bdf00","repo":"apache/shardingsphere","slug":"getscale","errorCode":null,"errorMessage":"getScale","messagePattern":"getScale","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java","lineNumber":48,"sourceCode":"    \n    @Override\n    public final int isNullable(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isNullable\");\n    }\n    \n    @Override\n    public final boolean isSigned(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isSigned\");\n    }\n    \n    @Override\n    public final int getPrecision(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getPrecision\");\n    }\n    \n    @Override\n    public final int getScale(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getScale\");\n    }\n    \n    @Override\n    public final int getParameterType(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterType\");\n    }\n    \n    @Override\n    public final String getParameterTypeName(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterTypeName\");\n    }\n    \n    @Override\n    public final String getParameterClassName(final int parameter) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getParameterClassName\");\n    }\n    \n    @Override","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationParameterMetaData.java#L30-L66","documentation":"SQLFeatureNotSupportedException thrown by AbstractUnsupportedOperationParameterMetaData.getScale(int). ShardingSphere's driver-side prepare has no backend type info for '?' placeholders, so scale (digits after the decimal point) cannot be computed; the final override always throws. ShardingSphereParameterMetaData implements only getParameterCount().","triggerScenarios":"ps.getParameterMetaData().getScale(i) against a jdbc:shardingsphere: URL. Hit by BigDecimal setScale logic and validation code that mirrors column scale in bind parameters.","commonSituations":"Apps ported from drivers that support server-side prepare (MySQL Connector/J with useServerPrepStmts=true, Oracle, DB2) where getScale worked; generic DAO layers that self-adjust BigDecimal scale before binding.","solutions":["Apply scale from the entity/table definition (e.g. JPA @Column(scale=...)) instead of ParameterMetaData.","Let the backend database coerce or reject the value; remove the client-side getScale check.","Catch SQLFeatureNotSupportedException around the probe and continue with the value's own scale."],"exampleFix":"// before\nBigDecimal v = value.setScale(pmd.getScale(1), RoundingMode.HALF_UP);\n\n// after\nBigDecimal v = value.setScale(entityScale, RoundingMode.HALF_UP); // scale from your mapping","handlingStrategy":"validation","validationCode":"int scale = (mapping != null) ? mapping.getScale() : -1; // from your own mapping; never pmd.getScale under ShardingSphere","typeGuard":null,"tryCatchPattern":"try { scale = pmd.getScale(1); } catch (final SQLFeatureNotSupportedException e) { scale = -1; /* fall back to value's own scale */ }","preventionTips":["Take scale from JPA @Column(scale=...) or equivalent mapping","Do not auto-adjust BigDecimal scale from ParameterMetaData","Run metadata-dependent code on a plain DataSource"],"tags":["jdbc","shardingsphere","parametermetadata","scale","sql-feature-not-supported"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}