{"record":{"id":"6009f88ba32f0d35","repo":"prestodb/presto","slug":"setobject","errorCode":null,"errorMessage":"setObject","messagePattern":"setObject","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":624,"sourceCode":"    @Override\n    public void setNClob(int parameterIndex, Reader reader, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setNClob\");\n    }\n\n    @Override\n    public void setSQLXML(int parameterIndex, SQLXML xmlObject)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setSQLXML\");\n    }\n\n    @Override\n    public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setObject\");\n    }\n\n    @Override\n    public void setAsciiStream(int parameterIndex, InputStream x, long length)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setAsciiStream\");\n    }\n\n    @Override\n    public void setBinaryStream(int parameterIndex, InputStream x, long length)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setBinaryStream\");\n    }\n\n    @Override\n    public void setCharacterStream(int parameterIndex, Reader reader, long length)","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L606-L642","documentation":"PrestoPreparedStatement.setObject(int, Object, int, int) — the four-argument variant with targetSqlType and scaleOrLength — is a stub throwing SQLFeatureNotSupportedException. The driver only supports simpler setObject forms; it cannot coerce an arbitrary object to an explicit SQL type with scale/length. The two-argument setObject(int, Object) delegates and callers often reach this from that path when it dispatches here.","triggerScenarios":"Calling PreparedStatement.setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) on a PrestoPreparedStatement; ORM/serialization layers that specify explicit Types.* targets and scale for DECIMAL or temporal bind values.","commonSituations":"JPA/Hibernate dialects binding BigDecimal with scale via the 4-arg setObject; query builders that pass java.sql.Timestamp with Types.TIMESTAMP through the 4-arg overload against Presto.","solutions":["Use the two-argument setObject(parameterIndex, x) and let the driver infer the type","Bind typed values with dedicated setters: setBigDecimal, setTimestamp, setInt, etc.","Pre-convert the value in application code to the exact type the driver supports, then bind it","Upgrade the Presto JDBC driver to a version that may implement the typed setObject overloads"],"exampleFix":"// before\npstmt.setObject(1, bigDecimalValue, Types.DECIMAL, 4);\n// after\npstmt.setBigDecimal(1, bigDecimalValue.setScale(4, RoundingMode.HALF_UP));","handlingStrategy":"fallback","validationCode":"if (x instanceof java.math.BigDecimal) pstmt.setBigDecimal(idx, (java.math.BigDecimal) x);\nelse if (x instanceof java.sql.Timestamp) pstmt.setTimestamp(idx, (java.sql.Timestamp) x);\nelse pstmt.setObject(idx, x); // 2-arg form only","typeGuard":"boolean hasDedicatedSetter(Object x) { return x instanceof String || x instanceof Number || x instanceof Boolean || x instanceof byte[] || x instanceof java.sql.Date || x instanceof java.sql.Time || x instanceof java.sql.Timestamp || x instanceof java.math.BigDecimal; }","tryCatchPattern":"try { pstmt.setObject(idx, x, targetSqlType, scaleOrLength); } catch (SQLFeatureNotSupportedException e) { pstmt.setObject(idx, coerce(x, targetSqlType, scaleOrLength)); }","preventionTips":["Use the 2-argument setObject or typed setters (setBigDecimal, setTimestamp) against Presto","Pre-scale BigDecimal values in application code instead of passing scaleOrLength","Keep explicit Types.* coercion out of the shared Presto bind path"],"tags":["jdbc","unsupported-feature","setobject","type-binding"],"backgroundTag":"sqlfeaturenotsupported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}