aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKhurshid Fayzullaev <khurshidfayzullaev@yahoo.com>2014-04-10 15:32:04 -0400
committerKhurshid Fayzullaev <khurshidfayzullaev@yahoo.com>2014-04-10 15:32:04 -0400
commitf8bc5fb042fb2477ea159fc359fdc06b493f0f3e (patch)
treecf46dfea51f9d634fad8fddf05e3a1d53a20ffd3 /src
parent6a3046099664e6003cb2b41752e3c8e3ea3f3d07 (diff)
downloadtrackermap-web-f8bc5fb042fb2477ea159fc359fdc06b493f0f3e.tar.gz
trackermap-web-f8bc5fb042fb2477ea159fc359fdc06b493f0f3e.tar.bz2
trackermap-web-f8bc5fb042fb2477ea159fc359fdc06b493f0f3e.zip
Update DataServiceImpl.java
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index 9706eb1b..cc0b30e0 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -191,14 +191,15 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
if (currentUser.getAdmin()) {
EntityManager entityManager = getSessionEntityManager();
synchronized (entityManager) {
+
+ String login = user.getLogin();
+ TypedQuery<User> query = entityManager.createQuery(
+ "SELECT x FROM User x WHERE x.login = :login", User.class);
+ query.setParameter("login", login);
+ List<User> results = query.getResultList();
+
entityManager.getTransaction().begin();
try {
- String login = user.getLogin();
- TypedQuery<User> query = entityManager.createQuery(
- "SELECT x FROM User x WHERE x.login = :login", User.class);
- query.setParameter("login", login);
- List<User> results = query.getResultList();
-
if (results.isEmpty()) {
entityManager.persist(user);
entityManager.getTransaction().commit();