aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java/com/juick/service
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/service')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
index 77735b0c..0273c1c3 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java
@@ -187,8 +187,13 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip
@Transactional
@Override
public boolean subscribeTag(final User user, final Tag toTag) {
- return getJdbcTemplate().update(
- "INSERT IGNORE INTO subscr_tags(tag_id,suser_id) VALUES (?,?)", toTag.TID, user.getUid()) == 1;
+ try {
+
+ return getJdbcTemplate().update(
+ "INSERT INTO subscr_tags(tag_id,suser_id) VALUES (?,?)", toTag.TID, user.getUid()) == 1;
+ } catch (DuplicateKeyException e) {
+ return true;
+ }
}
@Transactional