From 99a02b06a63a3c48999575a1db2a6dc093812ee2 Mon Sep 17 00:00:00 2001 From: Khurshid Fayzullaev Date: Thu, 10 Apr 2014 16:01:44 -0400 Subject: Update DataServiceImpl.java --- src/org/traccar/web/server/model/DataServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 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 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 query = entityManager.createQuery("SELECT x FROM Device x WHERE x.uniqueId = :id", Device.class); query.setParameter("id", device.getUniqueId()); List results = query.getResultList(); + ser user = getSessionUser(); entityManager.getTransaction().begin(); try { if (results.isEmpty()) { -- cgit v1.2.3