aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src/main/java
diff options
context:
space:
mode:
authorGravatar Sanny Sanoff2016-07-15 21:33:25 +0300
committerGravatar Sanny Sanoff2016-07-15 21:33:25 +0300
commitc8103ad9478f928e366b784ef95e4d92068ab4ed (patch)
treeac182654761579c16201223e23cb4bd807cc1d22 /juick-core/src/main/java
parentf032e21ce93603a8f3491cdcb5ff4532e0373bf9 (diff)
additional nail into the coffin of duplicate sequence values for replies
Diffstat (limited to 'juick-core/src/main/java')
-rw-r--r--juick-core/src/main/java/com/juick/server/MessagesQueries.java3
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()) {