Skip to content

Commit

Permalink
Fixes #77 - devices removal was broken when device events were added in
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalidze committed Jan 31, 2015
1 parent 33ea27e commit 42dd5f9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ public Device removeDevice(Device device) {
device.setLatestPosition(null);
entityManager.flush();

Query query = entityManager.createQuery("DELETE FROM Position x WHERE x.device = :device");
Query query = entityManager.createQuery("DELETE FROM DeviceEvent x WHERE x.device = :device");
query.setParameter("device", device);
query.executeUpdate();

query = entityManager.createQuery("DELETE FROM DeviceEvent x WHERE x.device = :device");
query = entityManager.createQuery("DELETE FROM Position x WHERE x.device = :device");
query.setParameter("device", device);
query.executeUpdate();

Expand Down

0 comments on commit 42dd5f9

Please sign in to comment.