Github user IsurangaPerera commented on a diff in the pull request:
https://github.com/apache/syncope/pull/70#discussion_r181088841
--- Diff:
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
---
@@ -135,11 +135,7 @@
accessToken.setAuthorities(authorities);
}
- accessTokenDAO.save(accessToken);
- }
-
- if (replaceExisting && existing != null) {
- accessTokenDAO.delete(existing);
+ accessTokenDAO.merge(accessToken);
--- End diff --
yes, merge function simply ensure the uniqueness constraint by checking if
the token exists and replace it if so. otherwise, it will create a new
register. so no need to perform this check here
---