Remove workaround for fix available in Hibernate 6.2.1

Closes #19323
This commit is contained in:
Alexander Schwartz 2023-04-27 18:34:49 +02:00 committed by Michal Hajas
parent 934a5186fd
commit a10d511b12

View file

@ -927,16 +927,7 @@ public class JpaUserProvider implements UserProvider, UserCredentialStore {
query.setParameter("identityProvider", identityProvider); query.setParameter("identityProvider", identityProvider);
query.setLockMode(lockMode); query.setLockMode(lockMode);
List<FederatedIdentityEntity> results = query.getResultList(); List<FederatedIdentityEntity> results = query.getResultList();
FederatedIdentityEntity federatedIdentityEntity = results.size() > 0 ? results.get(0) : null; return 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;
} }