diff --git a/reconciler/src/main/java/edu/rit/se/nvip/DatabaseHelper.java b/reconciler/src/main/java/edu/rit/se/nvip/DatabaseHelper.java index 1cd8d49d8..0043cd664 100644 --- a/reconciler/src/main/java/edu/rit/se/nvip/DatabaseHelper.java +++ b/reconciler/src/main/java/edu/rit/se/nvip/DatabaseHelper.java @@ -799,9 +799,15 @@ public boolean exploitExists(String cveId) { } public void insertSSVCSet(Set vulns) { - try (Connection conn = getConnection(); PreparedStatement pstmt = conn.prepareStatement(INSERT_SSVC)) { + String deleteOldSSVC = "DELETE FROM ssvc WHERE cve_id = ?"; + try (Connection conn = getConnection(); PreparedStatement pstmt = conn.prepareStatement(INSERT_SSVC); + PreparedStatement deleteStmt = conn.prepareStatement(deleteOldSSVC)) { conn.setAutoCommit(false); for (CompositeVulnerability vuln : vulns) { + deleteStmt.setString(1, vuln.getCveId()); + deleteStmt.executeUpdate(); + + // Get SSVC data final SSVC ssvc = vuln.getSSVC();