From bc10bf9257ef64567a487389ab514e14bae15377 Mon Sep 17 00:00:00 2001 From: manoj Date: Tue, 21 Apr 2015 14:59:29 +0530 Subject: [PATCH] Fix operations sql changing column names operation details --- .../operation/mgt/dao/impl/OperationDAOImpl.java | 14 +++++++------- .../mgt/dao/impl/ProfileOperationDAOImpl.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java index d9ae0639fb..b4d852f8a3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java @@ -256,10 +256,10 @@ public class OperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATIONCODE, " + - "po.OPERATIONDETAILS,co.ENABLED from " + + String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE, " + + "po.OPERATION_DETAILS,co.ENABLED from " + "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS, " + - "OPERATIONCODE FROM DM_OPERATION WHERE STATUS=?) o " + + "OPERATION_CODE FROM DM_OPERATION WHERE STATUS=?) o " + "INNER JOIN (Select * from DM_DEVICE_OPERATION_MAPPING dm " + "where dm.DEVICE_ID=?) om ON o.ID = om.OPERATION_ID LEFT OUTER JOIN DM_PROFILE_OPERATION po ON " + "o.ID =po.OPERATION_ID LEFT OUTER JOIN DM_COMMAND_OPERATION co ON co.OPERATION_ID=o.ID"; @@ -329,10 +329,10 @@ public class OperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATIONCODE, " + - "po.OPERATIONDETAILS,co.ENABLED from " + + String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE, " + + "po.OPERATION_DETAILS,co.ENABLED from " + "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS, " + - "OPERATIONCODE FROM DM_OPERATION) o " + + "OPERATION_CODE FROM DM_OPERATION) o " + "INNER JOIN (Select * from DM_DEVICE_OPERATION_MAPPING dm " + "where dm.DEVICE_ID=?) om ON o.ID = om.OPERATION_ID LEFT OUTER JOIN DM_PROFILE_OPERATION po ON " + "o.ID =po.OPERATION_ID LEFT OUTER JOIN DM_COMMAND_OPERATION co ON co.OPERATION_ID=o.ID"; @@ -404,7 +404,7 @@ public class OperationDAOImpl implements OperationDAO { String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE,"+ "po.OPERATION_DETAILS,co.ENABLED from "+ "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS,"+ - "OPERATIONCODE FROM DM_OPERATION WHERE STATUS=?) o "+ + "OPERATION_CODE FROM DM_OPERATION WHERE STATUS=?) o "+ "LEFT OUTER JOIN DM_PROFILE_OPERATION po ON "+ "o.ID =po.OPERATION_ID LEFT OUTER JOIN DM_COMMAND_OPERATION co ON co.OPERATION_ID=o.ID"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index 22a459533f..efd42803b2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -70,7 +70,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl { try { Connection connection = OperationManagementDAOFactory.getConnection(); stmt = connection.prepareStatement( - "SELECT po.OPERATION_DETAILS AS OPERATIONDETAILS " + + "SELECT po.OPERATION_DETAILS AS OPERATION_DETAILS " + "FROM DM_OPERATION o " + "INNER JOIN DM_PROFILE_OPERATION po ON o.ID = po.OPERATION_ID AND o.STATUS =? AND o.ID IN (" + @@ -86,7 +86,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl { byte[] operationDetails = new byte[0]; if (rs.next()) { - operationDetails = rs.getBytes("OPERATIONDETAILS"); + operationDetails = rs.getBytes("OPERATION_DETAILS"); } bais = new ByteArrayInputStream(operationDetails); ois = new ObjectInputStream(bais);