From c5c60d7262e774eeb3314d5af5a432b26c8210cf Mon Sep 17 00:00:00 2001 From: Khurshid Fayzullaev Date: Tue, 15 Apr 2014 17:48:33 -0400 Subject: Update DataServiceImpl.java Solves Problem #166 `merge()` erases the *Latest Position* field. That is why, Markers are disappearing. We have to upgrade the Device Details keeping that very field. --- src/org/traccar/web/server/model/DataServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java index fb8724ae..db10bd5e 100644 --- a/src/org/traccar/web/server/model/DataServiceImpl.java +++ b/src/org/traccar/web/server/model/DataServiceImpl.java @@ -339,9 +339,11 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService if (results.isEmpty()) { entityManager.getTransaction().begin(); try { - device = entityManager.merge(device); + Device tmp_device = entityManager.find(Device.class, device.getId()); + tmp_device.setName(device.getName()); + tmp_device.setUniqueId(device.getUniqueId()); entityManager.getTransaction().commit(); - return device; + return tmp_device; } catch (RuntimeException e) { entityManager.getTransaction().rollback(); throw e; -- cgit v1.2.3