diff options
author | Sanny Sanoff | 2016-07-15 21:33:25 +0300 |
---|---|---|
committer | Sanny Sanoff | 2016-07-15 21:33:25 +0300 |
commit | c8103ad9478f928e366b784ef95e4d92068ab4ed (patch) | |
tree | ac182654761579c16201223e23cb4bd807cc1d22 /juick-core | |
parent | f032e21ce93603a8f3491cdcb5ff4532e0373bf9 (diff) |
additional nail into the coffin of duplicate sequence values for replies
Diffstat (limited to 'juick-core')
-rw-r--r-- | juick-core/src/main/java/com/juick/server/MessagesQueries.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/juick-core/src/main/java/com/juick/server/MessagesQueries.java b/juick-core/src/main/java/com/juick/server/MessagesQueries.java index e6188a86..5659e79c 100644 --- a/juick-core/src/main/java/com/juick/server/MessagesQueries.java +++ b/juick-core/src/main/java/com/juick/server/MessagesQueries.java @@ -159,6 +159,9 @@ public class MessagesQueries { return sql.execute((ConnectionCallback<Integer>) conn -> { conn.setAutoCommit(false); final int replyNo; + try (PreparedStatement ps = conn.prepareStatement("START TRANSACTION")) { + ps.executeUpdate(); + } try (PreparedStatement ps = conn.prepareStatement("SELECT maxreplyid+1 FROM messages WHERE message_id=? FOR UPDATE")) { ps.setInt(1, mid); try (ResultSet resultSet = ps.executeQuery()) { |