pinpoint-apm/pinpoint · error · java.lang.UnsupportedOperationException
UnsupportedOperationException
Error message
UnsupportedOperationException
What it means
PreparedStatementParameterLogger is a JDBC PreparedStatement wrapper that only logs SQL parameters; it delegates the actual execution to an underlying statement. Statements that do not make sense for a prepared statement being parameter-logged — like getGeneratedKeys() — are hardcoded to throw UnsupportedOperationException.
Solutions
- Obtain generated keys from the unwrapped, original PreparedStatement (unwrap or keep a reference before wrapping).
- Restructure the code so key retrieval does not pass through the parameter-logging wrapper.
- If this blocks a use case, fall back to selecting the generated key with an explicit query (e.g. LAST_INSERT_ID) rather than getGeneratedKeys().
Example fix
// before ResultSet keys = loggingStatement.getGeneratedKeys(); // after PreparedStatement raw = loggingStatement.unwrap(PreparedStatement.class); ResultSet keys = raw.getGeneratedKeys();
Defensive patterns
Strategy: try-catch
Try / catch
try {
keys = stmt.getGeneratedKeys();
} catch (UnsupportedOperationException e) {
PreparedStatement raw = stmt.unwrap(PreparedStatement.class);
keys = raw.getGeneratedKeys();
} Prevention
- Do not call getGeneratedKeys() through the parameter-logging wrapper.
- Keep a reference to the original PreparedStatement for key retrieval.
- Know which statement methods the wrapper delegates vs. rejects.
When it happens
Trigger: Calling getGeneratedKeys() on a PreparedStatement wrapped by the parameter logger, typically when using IDENTITY/auto-generated key retrieval through code instrumented by this plugin.
Common situations: MyBatis/DAO code using useGeneratedKeys or Statement.RETURN_GENERATED_KEYS while the Pinpoint mybatis plugin wraps the statement for logging; retrieving auto-generated IDs inside an instrumented path.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- slot type
- UNSUPPORTED_OPERATION
- absolute start/end time is only supported for TRACE_V3 spans
- absolute start/end time is only supported for TRACE_V3 span…
- method not found.
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/a15c0d4ffada19b3.
Report an issue: GitHub.
Appendix: source
Thrown at commons-mybatis/src/main/java/com/navercorp/pinpoint/mybatis/plugin/PreparedStatementParameterLogger.java:493
@Override
public int[] executeBatch() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Connection getConnection() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public boolean getMoreResults(int current) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public ResultSet getGeneratedKeys() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException();
}
@OverrideView on GitHub (pinned to 744c3d3075)