aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-18 11:26:29 +0300
committerGravatar Vitaly Takmazov2022-12-18 11:26:29 +0300
commitcda8b704fd56ff6596690faeb793f23078f1b2d4 (patch)
tree0a01265533b8c5912120f108f91eb37c9dc3e0c7 /src/main
parenteaf04f18001159cf5aaa3c9747a300b48e8d3f2f (diff)
`addGCMToken` fix
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/service/PushQueriesServiceImpl.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/juick/service/PushQueriesServiceImpl.java b/src/main/java/com/juick/service/PushQueriesServiceImpl.java
index 0dfa59df..0b83465a 100644
--- a/src/main/java/com/juick/service/PushQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PushQueriesServiceImpl.java
@@ -57,8 +57,12 @@ public class PushQueriesServiceImpl extends BaseJdbcService implements PushQueri
@Transactional
@Override
public boolean addGCMToken(Integer uid, String token) {
- return getJdbcTemplate().update("INSERT IGNORE INTO android(user_id,regid) VALUES (?, ?)",
- uid, token) > 0;
+ try {
+ return getJdbcTemplate().update("INSERT INTO android(user_id,regid) VALUES (?, ?)",
+ uid, token) > 0;
+ } catch (DataIntegrityViolationException e) {
+ return false;
+ }
}
@Transactional