From 137c89bc9a870c4018f4c000494c89af9ceea67a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 9 Jan 2013 23:34:39 +1300 Subject: Finished archive panel --- src/org/traccar/web/server/model/DataServiceImpl.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/org/traccar/web/server/model') 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; } -- cgit v1.2.3