|
|
@ -42,8 +42,7 @@ public class DeviceDAOImpl implements DeviceDAO {
|
|
|
|
int deviceId = -1;
|
|
|
|
int deviceId = -1;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String sql =
|
|
|
|
String sql = "INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, TENANT_ID) " +
|
|
|
|
"INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, TENANT_ID) " +
|
|
|
|
|
|
|
|
"VALUES (?, ?, ?, ?, ?)";
|
|
|
|
"VALUES (?, ?, ?, ?, ?)";
|
|
|
|
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
|
|
|
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
|
|
|
stmt.setString(1, device.getDescription());
|
|
|
|
stmt.setString(1, device.getDescription());
|
|
|
@ -74,8 +73,7 @@ public class DeviceDAOImpl implements DeviceDAO {
|
|
|
|
int deviceId = -1;
|
|
|
|
int deviceId = -1;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String sql =
|
|
|
|
String sql = "UPDATE DM_DEVICE SET DESCRIPTION = ?, NAME = ? WHERE DEVICE_IDENTIFICATION = ? AND " +
|
|
|
|
"UPDATE DM_DEVICE SET DESCRIPTION = ?, NAME = ? WHERE DEVICE_IDENTIFICATION = ? AND " +
|
|
|
|
|
|
|
|
"DEVICE_TYPE_ID = ? AND TENANT_ID = ?";
|
|
|
|
"DEVICE_TYPE_ID = ? AND TENANT_ID = ?";
|
|
|
|
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
|
|
|
stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
|
|
|
stmt.setString(1, device.getDescription());
|
|
|
|
stmt.setString(1, device.getDescription());
|
|
|
|