aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/server/model
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-09 23:34:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-09 23:34:39 +1300
commit137c89bc9a870c4018f4c000494c89af9ceea67a (patch)
treeecee16a30a9c2742a97f715427b3b77ab66541aa /src/org/traccar/web/server/model
parent803ddb7af2d2ad33a5beeded3bc53963b16454d0 (diff)
downloadtrackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.tar.gz
trackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.tar.bz2
trackermap-web-137c89bc9a870c4018f4c000494c89af9ceea67a.zip
Finished archive panel
Diffstat (limited to 'src/org/traccar/web/server/model')
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index cfcc6226..f9d0e7e3 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -90,8 +90,10 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
entityManager.getTransaction().begin();
try {
entityManager.persist(user);
- } finally {
entityManager.getTransaction().commit();
+ } catch (Exception e) {
+ entityManager.getTransaction().rollback();
+ throw e;
}
setUser(user);
return true;
@@ -112,8 +114,10 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
try {
entityManager.persist(device);
user.getDevices().add(device);
- } finally {
entityManager.getTransaction().commit();
+ } catch (Exception e) {
+ entityManager.getTransaction().rollback();
+ throw e;
}
return device;
}
@@ -123,8 +127,10 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
entityManager.getTransaction().begin();
try {
device = entityManager.merge(device);
- } finally {
entityManager.getTransaction().commit();
+ } catch (Exception e) {
+ entityManager.getTransaction().rollback();
+ throw e;
}
return device;
}
@@ -137,8 +143,10 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
device = entityManager.merge(device);
user.getDevices().remove(device);
entityManager.remove(device);
- } finally {
entityManager.getTransaction().commit();
+ } catch (Exception e) {
+ entityManager.getTransaction().rollback();
+ throw e;
}
return device;
}