From d401741d9bd32bb7727e5897f5d989f3b8716823 Mon Sep 17 00:00:00 2001 From: harshanl Date: Wed, 10 Aug 2016 12:55:58 +0530 Subject: [PATCH] Fixed EMM-1492 --- .../mgt/core/dao/impl/EnrollmentDAOImpl.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java index abb9b1f87c5..2972697b953 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java @@ -73,18 +73,16 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { int status = -1; try { conn = this.getConnection(); - String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " + - "DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?" + - " AND ID = ?"; + String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, DATE_OF_LAST_UPDATE = ? WHERE DEVICE_ID = ?" + + " AND OWNER = ? AND TENANT_ID = ? AND ID = ?"; stmt = conn.prepareStatement(sql); stmt.setString(1, enrolmentInfo.getOwnership().toString()); stmt.setString(2, enrolmentInfo.getStatus().toString()); - stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment())); - stmt.setTimestamp(4, new Timestamp(new Date().getTime())); - stmt.setInt(5, deviceId); - stmt.setString(6, enrolmentInfo.getOwner()); - stmt.setInt(7, tenantId); - stmt.setInt(8, enrolmentInfo.getId()); + stmt.setTimestamp(3, new Timestamp(new Date().getTime())); + stmt.setInt(4, deviceId); + stmt.setString(5, enrolmentInfo.getOwner()); + stmt.setInt(6, tenantId); + stmt.setInt(7, enrolmentInfo.getId()); stmt.executeUpdate(); return status; } catch (SQLException e) { @@ -102,14 +100,12 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { int status = -1; try { conn = this.getConnection(); - String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " + - "DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE ID = ?"; + String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, DATE_OF_LAST_UPDATE = ? WHERE ID = ?"; stmt = conn.prepareStatement(sql); stmt.setString(1, enrolmentInfo.getOwnership().toString()); stmt.setString(2, enrolmentInfo.getStatus().toString()); - stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment())); - stmt.setTimestamp(4, new Timestamp(new Date().getTime())); - stmt.setInt(5, enrolmentInfo.getId()); + stmt.setTimestamp(3, new Timestamp(new Date().getTime())); + stmt.setInt(4, enrolmentInfo.getId()); stmt.executeUpdate(); return status; } catch (SQLException e) {