Code review comment: Can we add a test case for this scenario as well.

Code under review:
public Object execute() {
        Connection conn = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;
        checkAndObserveSQLAction(strand, datasource, query);
        boolean isInTransaction = strand.isInTransaction();
        String errorMessagePrefix = "failed to execute update query: ";
        MapValue<String, Object> generatedKeys = new MapValueImpl<>();
        try {
            ArrayValue generatedParams = constructParameters(parameters);
            conn = getDatabaseConnection(strand, client, datasource);
            String processedQuery = createProcessedQueryString(query, generatedParams);

            if (returnGeneratedKeys) {
                stmt = conn.prepareStatement(processedQuery, PreparedStatement.RETURN_GENERATED_KEYS);
            } else {
                stmt = conn.prepareStatement(processedQuery);
            }

            ProcessedStatement processedStatement = new ProcessedStatement(conn, stmt, generatedParams,
                    datasource.getDatabaseProductName());
            stmt = processedStatement.prepare();
            int count = stmt.executeUpdate();
            if (returnGeneratedKeys) {
                if (isKeyRetrievalSupported()) {
                    rs = stmt.getGeneratedKeys();
                    
                    if (rs.next()) {
                        generatedKeys = getGeneratedKeys(rs);
                    }
                } else {
                    handleErrorOnTransaction(this.strand);
                    String message = "The returnGeneratedKeys only support INSERT, UPDATE, DELETE and MERGE " +
                            "operations.";
                    checkAndObserveSQLError(strand, "execute update failed: " + message);
                    return ErrorGenerator.getSQLApplicationError(message);
                }
            }
            return createFrozenUpdateResultRecord(count, generatedKeys);
        } catch (SQLException e) {
            handleErrorOnTransaction(this.strand);
            checkAndObserveSQLError(strand, "execute update failed: " + e.getMessage());
            return ErrorGenerator.getSQLDatabaseError(e, errorMessagePrefix);
        } catch (ApplicationException e) {
            handleErrorOnTransaction(this.strand);
            checkAndObserveSQLError(strand, "execute update failed: " + e.getMessage());
            return ErrorGenerator.getSQLApplicationError(e, errorMessagePrefix);
        } finally {
            cleanupResources(rs, stmt, conn, !isInTransaction);
        }
    }

Line commented on: return ErrorGenerator.getSQLApplicationError(message);

Revised code:
public Object execute() {
        Connection conn = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;
        checkAndObserveSQLAction(strand, datasource, query);
        boolean isInTransaction = strand.isInTransaction();
        String errorMessagePrefix = "failed to execute update query: ";
        MapValue<String, Object> generatedKeys = new MapValueImpl<>();
        try {
            ArrayValue generatedParams = constructParameters(parameters);
            conn = getDatabaseConnection(strand, client, datasource);
            String processedQuery = createProcessedQueryString(query, generatedParams);

            if (returnGeneratedKeys) {
                stmt = conn.prepareStatement(processedQuery, PreparedStatement.RETURN_GENERATED_KEYS);
            } else {
                stmt = conn.prepareStatement(processedQuery);
            }

            ProcessedStatement processedStatement = new ProcessedStatement(conn, stmt, generatedParams,
                    datasource.getDatabaseProductName());
            stmt = processedStatement.prepare();
            int count = stmt.executeUpdate();
            if (returnGeneratedKeys) {
                rs = stmt.getGeneratedKeys();
                
                if (rs.next()) {
                    generatedKeys = getGeneratedKeys(rs);
                }
            }
            return createFrozenUpdateResultRecord(count, generatedKeys);
        } catch (SQLException e) {
            handleErrorOnTransaction(this.strand);
            checkAndObserveSQLError(strand, "execute update failed: " + e.getMessage());
            return ErrorGenerator.getSQLDatabaseError(e, errorMessagePrefix);
        } catch (ApplicationException e) {
            handleErrorOnTransaction(this.strand);
            checkAndObserveSQLError(strand, "execute update failed: " + e.getMessage());
            return ErrorGenerator.getSQLApplicationError(e, errorMessagePrefix);
        } finally {
            cleanupResources(rs, stmt, conn, !isInTransaction);
        }
    }