Fixed query issue in function getDevicesByName

4.x.x
mharindu 10 years ago
parent 3db38b7e17
commit 3d549701a4

@ -350,8 +350,8 @@ public class DeviceDAOImpl implements DeviceDAO {
"DM_DEVICE.OWNERSHIP, DM_DEVICE.STATUS, DM_DEVICE.DEVICE_TYPE_ID, " + "DM_DEVICE.OWNERSHIP, DM_DEVICE.STATUS, DM_DEVICE.DEVICE_TYPE_ID, " +
"DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE.OWNER, DM_DEVICE.TENANT_ID FROM " + "DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE.OWNER, DM_DEVICE.TENANT_ID FROM " +
"DM_DEVICE, DM_DEVICE_TYPE WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID " + "DM_DEVICE, DM_DEVICE_TYPE WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID " +
"AND DM_DEVICE.NAME LIKE %?% AND DM_DEVICE.TENANT_ID =?"); "AND DM_DEVICE.NAME LIKE ? AND DM_DEVICE.TENANT_ID =?");
stmt.setString(1, deviceName); stmt.setString(1, deviceName + "%");
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -366,7 +366,6 @@ public class DeviceDAOImpl implements DeviceDAO {
device.setName(resultSet.getString(5)); device.setName(resultSet.getString(5));
device.setDateOfEnrollment(resultSet.getLong(6)); device.setDateOfEnrollment(resultSet.getLong(6));
device.setDateOfLastUpdate(resultSet.getLong(7)); device.setDateOfLastUpdate(resultSet.getLong(7));
//TODO:- Ownership is not a enum in DeviceDAO
device.setOwnerShip(resultSet.getString(8)); device.setOwnerShip(resultSet.getString(8));
device.setStatus(Status.valueOf(resultSet.getString(9))); device.setStatus(Status.valueOf(resultSet.getString(9)));
device.setDeviceTypeId(resultSet.getInt(10)); device.setDeviceTypeId(resultSet.getInt(10));

Loading…
Cancel
Save