diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-11 18:52:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-11 18:52:32 +1300 |
commit | cd29641995e256e82828dd6eef44bb83186463c3 (patch) | |
tree | 45c4dc3f6eca1f5027c5fe2fe33c1d167ee9253b /src/org/traccar/model/DatabaseDataManager.java | |
parent | 717b60cef1e0bdeacb2f412018a8332a15c25f04 (diff) | |
download | trackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.tar.gz trackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.tar.bz2 trackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.zip |
Fix database generated keys (fix #53)
Diffstat (limited to 'src/org/traccar/model/DatabaseDataManager.java')
-rw-r--r-- | src/org/traccar/model/DatabaseDataManager.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java index 384d87828..7521828a3 100644 --- a/src/org/traccar/model/DatabaseDataManager.java +++ b/src/org/traccar/model/DatabaseDataManager.java @@ -15,8 +15,7 @@ */ package org.traccar.model; -import java.sql.ResultSet; -import java.sql.SQLException; +import java.sql.*; import java.util.*; import org.traccar.helper.AdvancedConnection; import org.traccar.helper.Log; @@ -130,7 +129,7 @@ public class DatabaseDataManager implements DataManager { public synchronized void addDevice(Device device) throws SQLException { - queryAddDevice.prepare(); + queryAddDevice.prepare(Statement.RETURN_GENERATED_KEYS); queryAddDevice.setString("imei", device.getImei()); queryAddDevice.executeUpdate(); |