aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 4e14f6c97..fcb8899bc 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -358,6 +358,9 @@ public class DataManager implements IdentityManager {
QueryBuilder.create(dataSource, getQuery("database.updateDeviceStatus"))
.setObject(device)
.executeUpdate();
+ Device cachedDevice = getDeviceById(device.getId());
+ cachedDevice.setStatus(device.getStatus());
+ cachedDevice.setMotion(device.getMotion());
}
public void removeDevice(long deviceId) throws SQLException {
@@ -466,6 +469,8 @@ public class DataManager implements IdentityManager {
.setDate("now", new Date())
.setObject(position)
.executeUpdate();
+ Device device = getDeviceById(position.getDeviceId());
+ device.setPositionId(position.getId());
}
public Collection<Position> getLatestPositions() throws SQLException {