From 1fe93715580b3ec19f549a5fd15bbd2f233f1b47 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 23 Dec 2015 21:41:10 +0530 Subject: [PATCH] Fixing https://wso2.org/jira/browse/EMM-1133 --- .../mgt/core/dao/impl/ApplicationMappingDAOImpl.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationMappingDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationMappingDAOImpl.java index 1200c86b93..0021c0dc96 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationMappingDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationMappingDAOImpl.java @@ -102,20 +102,17 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO { Connection conn; PreparedStatement stmt = null; try { - conn = this.getConnection(); String sql = "DELETE DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID = ? AND " + "APPLICATION_ID = ? AND TENANT_ID = ?"; - conn.setAutoCommit(false); - stmt = conn.prepareStatement(sql); - - for (Integer appId : appIdList) { + conn = this.getConnection(); + for (int appId : appIdList) { + stmt = conn.prepareStatement(sql); stmt.setInt(1, deviceId); stmt.setInt(2, appId); stmt.setInt(3, tenantId); - stmt.addBatch(); + stmt.execute(); } - stmt.executeBatch(); } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while adding device application mapping", e); } finally {