Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/70#discussion_r181093676
  
    --- Diff: 
core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAccessTokenDAO.java
 ---
    @@ -115,6 +115,16 @@ public AccessToken save(final AccessToken accessToken) 
{
             return entityManager().merge(accessToken);
         }
     
    +    @Override
    +    @Transactional(rollbackFor = Throwable.class)
    +    public void merge(final AccessToken accessToken) {
    +        AccessToken existing = findByOwner(accessToken.getOwner());
    +        if (existing != null) {
    +            entityManager().remove(existing);
    +        }
    +        entityManager().persist(accessToken);
    --- End diff --
    
    Also, replace `entityManager().remove(existing)` with `delete(existing)`, 
thanks.


---

Reply via email to