Fix sql syntax errors

stream-api
Pramila Niroshan 6 months ago
parent 9517e80939
commit 641ddbfb85

@ -273,7 +273,7 @@ public class GroupManagementServiceImpl implements GroupManagementService {
); );
return Response.status(Response.Status.OK).build(); return Response.status(Response.Status.OK).build();
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
String msg = "Error occurred while adding new group."; String msg = "Error occurred while updating group. ";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupNotExistException e) { } catch (GroupNotExistException e) {

@ -176,7 +176,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
+ "d.DESCRIPTION, " + "d.DESCRIPTION, "
+ "d.NAME, " + "d.NAME, "
+ "d.LAST_UPDATED_TIMESTAMP " + "d.LAST_UPDATED_TIMESTAMP "
+ "FROM DM_DEVICE d" + "FROM DM_DEVICE d WHERE "
+ "d.DEVICE_IDENTIFICATION = ? AND " + "d.DEVICE_IDENTIFICATION = ? AND "
+ "d.TENANT_ID = ?"; + "d.TENANT_ID = ?";
@ -197,7 +197,6 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIndx = 1; int paramIndx = 1;
stmt.setString(paramIndx++, deviceData.getDeviceIdentifier().getType());
stmt.setString(paramIndx++, deviceData.getDeviceIdentifier().getId()); stmt.setString(paramIndx++, deviceData.getDeviceIdentifier().getId());
stmt.setInt(paramIndx++, tenantId); stmt.setInt(paramIndx++, tenantId);
if (deviceData.getLastModifiedDate() != null) { if (deviceData.getLastModifiedDate() != null) {
@ -964,12 +963,12 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
+ "d.NAME AS DEVICE_NAME, " + "d.NAME AS DEVICE_NAME, "
+ "d.DEVICE_IDENTIFICATION, " + "d.DEVICE_IDENTIFICATION, "
+ "d.LAST_UPDATED_TIMESTAMP, " + "d.LAST_UPDATED_TIMESTAMP, "
+ "e.DEVICE_TYPE " + "e1.DEVICE_TYPE "
+ "FROM " + "FROM "
+ "DM_DEVICE d, " + "DM_DEVICE d, "
+ "(SELECT " + "(SELECT "
+ "e.OWNER, " + "e.OWNER, "
+ "e.DEVICE_TYPE " + "e.DEVICE_TYPE, "
+ "e.OWNERSHIP, " + "e.OWNERSHIP, "
+ "e.ID AS ENROLMENT_ID, " + "e.ID AS ENROLMENT_ID, "
+ "e.DEVICE_ID, " + "e.DEVICE_ID, "

@ -1282,8 +1282,8 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
StringJoiner joiner = new StringJoiner(",","SELECT " StringJoiner joiner = new StringJoiner(",","SELECT "
+ "d1.DEVICE_ID, " + "d1.DEVICE_ID, "
+ "d1.DESCRIPTION, " + "d1.DESCRIPTION, "
+ "e.DEVICE_NAME, " + "d1.NAME AS DEVICE_NAME, "
+ "d1.DEVICE_TYPE, " + "e.DEVICE_TYPE, "
+ "d1.DEVICE_IDENTIFICATION, " + "d1.DEVICE_IDENTIFICATION, "
+ "d1.LAST_UPDATED_TIMESTAMP, " + "d1.LAST_UPDATED_TIMESTAMP, "
+ "e.OWNER, " + "e.OWNER, "
@ -1343,8 +1343,8 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
String sql = "SELECT " String sql = "SELECT "
+ "d1.DEVICE_ID, " + "d1.DEVICE_ID, "
+ "d1.DESCRIPTION, " + "d1.DESCRIPTION, "
+ "e.DEVICE_NAME, " + "d1.NAME AS DEVICE_NAME, "
+ "d1.DEVICE_TYPE, " + "e.DEVICE_TYPE, "
+ "d1.DEVICE_IDENTIFICATION, " + "d1.DEVICE_IDENTIFICATION, "
+ "d1.LAST_UPDATED_TIMESTAMP, " + "d1.LAST_UPDATED_TIMESTAMP, "
+ "e.OWNER, " + "e.OWNER, "

Loading…
Cancel
Save