diff options
Diffstat (limited to 'src/org/traccar/web/server/model/DataServiceImpl.java')
-rw-r--r-- | src/org/traccar/web/server/model/DataServiceImpl.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java index 3164b102..7f4172e0 100644 --- a/src/org/traccar/web/server/model/DataServiceImpl.java +++ b/src/org/traccar/web/server/model/DataServiceImpl.java @@ -303,12 +303,11 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService public Device addDevice(Device device) { EntityManager entityManager = getSessionEntityManager(); synchronized (entityManager) { - User user = getSessionUser(); - TypedQuery<Device> query = entityManager.createQuery("SELECT x FROM Device x WHERE x.uniqueId = :id", Device.class); query.setParameter("id", device.getUniqueId()); List<Device> results = query.getResultList(); + ser user = getSessionUser(); entityManager.getTransaction().begin(); try { if (results.isEmpty()) { |