Fix device delete issue

reporting
Pahansith 5 years ago
parent 1d229a9fe3
commit 552015e6f0

@ -2397,8 +2397,9 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
*/
private void removeDeviceOperationResponse(Connection conn, List<Integer> enrollmentIds)
throws DeviceManagementDAOException {
String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE ENROLMENT_ID = ?";
try {
deleteLargePayloadRecords(conn, enrollmentIds);
String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE ENROLMENT_ID = ?";
if (!executeBatchOperation(conn, sql, enrollmentIds)) {
String msg = "Failed to remove device operation response of devices with enrollmentIds : "
+ enrollmentIds + " while executing batch operation";
@ -2413,6 +2414,29 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
}
}
private void deleteLargePayloadRecords(Connection conn, List<Integer> enrollmentIds)
throws DeviceManagementDAOException {
String sql = "DELETE DM_DEVICE_OPERATION_RESPONSE_LARGE " +
"FROM DM_DEVICE_OPERATION_RESPONSE_LARGE " +
"INNER JOIN DM_DEVICE_OPERATION_RESPONSE ON DM_DEVICE_OPERATION_RESPONSE_LARGE.ID = " +
"DM_DEVICE_OPERATION_RESPONSE.ID " +
"WHERE ENROLMENT_ID = ?";
try {
if (!executeBatchOperation(conn, sql, enrollmentIds)) {
String msg = "Failed to remove device large operation response of devices with " +
"enrollmentIds : "
+ enrollmentIds + " while executing batch operation";
log.error(msg);
throw new DeviceManagementDAOException(msg);
}
} catch (SQLException e) {
String msg = "SQL error occurred while removing large device operation response of " +
"devices with enrollmentIds : " + enrollmentIds;
log.error(msg, e);
throw new DeviceManagementDAOException(msg, e);
}
}
/***
* This method removes records of a given list of enrollments from the DM_ENROLMENT_OP_MAPPING table
* @param conn Connection object

Loading…
Cancel
Save