aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/server
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 00:54:34 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 00:54:34 +1300
commit9f60706d957a183433cd61de9e422e565a1f15d4 (patch)
tree34de97ebc1936eab9315f63af3e149a4a6dbf180 /src/org/traccar/web/server
parent3eaf89d64402e16daf256174cba5985e3774aa55 (diff)
downloadetbsa-traccar-web-9f60706d957a183433cd61de9e422e565a1f15d4.tar.gz
etbsa-traccar-web-9f60706d957a183433cd61de9e422e565a1f15d4.tar.bz2
etbsa-traccar-web-9f60706d957a183433cd61de9e422e565a1f15d4.zip
Add latest position to device
Diffstat (limited to 'src/org/traccar/web/server')
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index 0b2a80b..fa7a42d 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -195,8 +195,8 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
User user = getUser();
if (!user.getDevices().isEmpty()) {
TypedQuery<Position> query = entityManager.createQuery(
- "SELECT x FROM Position x WHERE (x.device, x.time) IN (" +
- "SELECT y.device, MAX(y.time) FROM Position y WHERE y.device IN :devices GROUP BY y.device)", Position.class);
+ "SELECT x FROM Position x WHERE x.id IN (" +
+ "SELECT y.latestPosition FROM Device y WHERE y IN (:devices))", Position.class);
query.setParameter("devices", user.getDevices());
positions.addAll(query.getResultList());
}