diff options
Diffstat (limited to 'juick-core/src/main/java/com')
-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 e6188a86d..5659e79c4 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()) { |