From a10d511b1202c2e548dfdb0f93142eac15d0f6ec Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Thu, 27 Apr 2023 18:34:49 +0200 Subject: [PATCH] Remove workaround for fix available in Hibernate 6.2.1 Closes #19323 --- .../java/org/keycloak/models/jpa/JpaUserProvider.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java index 46af7d1f00..3ccd00ac12 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java @@ -927,16 +927,7 @@ public class JpaUserProvider implements UserProvider, UserCredentialStore { query.setParameter("identityProvider", identityProvider); query.setLockMode(lockMode); List results = query.getResultList(); - FederatedIdentityEntity federatedIdentityEntity = results.size() > 0 ? results.get(0) : null; - if (federatedIdentityEntity != null) { - // When upgrading from Hibernate 5 to Hibernate 6.2.0.CR3, the `user` wasn't filled in the returned row any more. - // This serves as a workaround until the cause has been found and the upstream project can provide a fix - // https://github.com/keycloak/keycloak/issues/19323 - if (federatedIdentityEntity.getUser() == null) { - federatedIdentityEntity.setUser(userEntity); - } - } - return federatedIdentityEntity; + return results.size() > 0 ? results.get(0) : null; }