reta commented on code in PR #3358:
URL: https://github.com/apache/cxf/pull/3358#discussion_r3749176662


##########
rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JPACMTCodeDataProvider.java:
##########
@@ -129,12 +132,37 @@ protected RefreshToken 
updateExistingRefreshToken(RefreshToken rt, ServerAccessT
         return super.updateExistingRefreshToken(rt, at);
     }
 
+    @Override
+    public ServerAuthorizationCodeGrant removeCodeGrant(final String code) 
throws OAuthServiceException {
+        return executeInTransaction(em -> findAndRemoveWithLock(code, em));
+    }
+
+    @Override
+    protected ServerAuthorizationCodeGrant removeCodeGrant(String code, 
EntityManager em,
+                                                           LockModeType 
lockModeType) throws OAuthServiceException {
+        return executeInTransaction(innerEm -> findAndRemoveWithLock(code, 
innerEm));

Review Comment:
   This one could be problematic, could we introduce 
`executeInTransaction(executeInTransaction(EntityManager em, 
EntityManagerOperation<T> operation)` here so the same entity manager is picked 
up? The issue of using another one is that the operation could be a part of 
larger transaction, and if the instance of the   entity manager is not 
preserved, it will have unintended effects



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to