aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/server/model/DataServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/web/server/model/DataServiceImpl.java')
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index e48fa73c..287a5684 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -152,6 +152,7 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
try {
entityManager.persist(device);
user.getDevices().add(device);
+ entityManager.merge(user);
entityManager.getTransaction().commit();
return device;
} catch (RuntimeException e) {
@@ -191,6 +192,7 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
device = entityManager.merge(device);
user.getDevices().remove(device);
entityManager.remove(device);
+ entityManager.merge(user);
entityManager.getTransaction().commit();
return device;
} catch (RuntimeException e) {