aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-13 17:46:13 +0300
committerGravatar Vitaly Takmazov2018-06-13 17:46:13 +0300
commit2236eee046e3ce304a3adcd9305ae6d6d2555003 (patch)
treebcf44f3aff0e787a88cc2215d5bbdf2132e5c392 /juick-server-jdbc/src/main/java/com/juick
parentfc66845def283a0a6bb60128ced5653b61423351 (diff)
h2db: disable mysql mode
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java
index 67d7b386..b68e0236 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java
@@ -18,6 +18,7 @@
package com.juick.service;
import com.juick.User;
+import org.springframework.dao.DuplicateKeyException;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Repository;
@@ -39,10 +40,13 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
uidFrom, uid_to, body) > 0;
if (ret) {
- getJdbcTemplate().update(
- "INSERT INTO pm_streams(user_id, user_id_to, lastmessage, unread) VALUES (?, ?, NOW(), 1) "
- + "ON DUPLICATE KEY UPDATE lastmessage = CURRENT_TIMESTAMP(), unread = unread + 1",
- uidFrom, uid_to);
+ try {
+ getJdbcTemplate().update(
+ "INSERT INTO pm_streams(user_id, user_id_to, lastmessage, unread) VALUES (?, ?, NOW(), 1)",
+ uidFrom, uid_to);
+ } catch (DuplicateKeyException e) {
+ // ignore
+ }
}
return ret;
}