diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/service/PushQueriesServiceImpl.java | 8 |
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 |