mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
fixing device update issue
This commit is contained in:
parent
ce144baec9
commit
b9e0b099a1
@ -82,16 +82,17 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
|
|||||||
int rows;
|
int rows;
|
||||||
try {
|
try {
|
||||||
conn = this.getConnection();
|
conn = this.getConnection();
|
||||||
String sql = "UPDATE DM_DEVICE SET DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " +
|
String sql = "UPDATE DM_DEVICE SET NAME = ?, DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " +
|
||||||
"WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " +
|
"WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " +
|
||||||
"AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?";
|
"AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?";
|
||||||
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
||||||
stmt.setString(1, device.getDescription());
|
stmt.setString(1, device.getName());
|
||||||
stmt.setTimestamp(2, new Timestamp(new Date().getTime()));
|
stmt.setString(2, device.getDescription());
|
||||||
stmt.setString(3, device.getType());
|
stmt.setTimestamp(3, new Timestamp(new Date().getTime()));
|
||||||
stmt.setInt(4, tenantId);
|
stmt.setString(4, device.getType());
|
||||||
stmt.setString(5, device.getDeviceIdentifier());
|
stmt.setInt(5, tenantId);
|
||||||
stmt.setInt(6, tenantId);
|
stmt.setString(6, device.getDeviceIdentifier());
|
||||||
|
stmt.setInt(7, tenantId);
|
||||||
rows = stmt.executeUpdate();
|
rows = stmt.executeUpdate();
|
||||||
return (rows > 0);
|
return (rows > 0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@ -274,7 +274,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId);
|
Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId);
|
||||||
device.setId(currentDevice.getId());
|
device.setId(currentDevice.getId());
|
||||||
device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId());
|
device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId());
|
||||||
|
device.setName(currentDevice.getName());
|
||||||
deviceDAO.updateDevice(device, tenantId);
|
deviceDAO.updateDevice(device, tenantId);
|
||||||
enrollmentDAO.updateEnrollment(device.getEnrolmentInfo());
|
enrollmentDAO.updateEnrollment(device.getEnrolmentInfo());
|
||||||
DeviceManagementDAOFactory.commitTransaction();
|
DeviceManagementDAOFactory.commitTransaction();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user