diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProviderFactory.java b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProviderFactory.java index 5afe3469cf..db4496bc85 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProviderFactory.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProviderFactory.java @@ -26,6 +26,7 @@ import org.keycloak.models.RealmProviderFactory; import javax.persistence.EntityManager; import org.keycloak.models.ClientModel; import org.keycloak.models.RealmModel; +import org.keycloak.models.RealmProvider; import org.keycloak.models.RoleContainerModel; import org.keycloak.models.RoleContainerModel.RoleRemovedEvent; import org.keycloak.models.RoleModel; @@ -83,7 +84,7 @@ public class JpaRealmProviderFactory implements RealmProviderFactory, ProviderEv } else { return; } - create(e.getKeycloakSession()).preRemove(realm, role); + ((JpaRealmProvider) e.getKeycloakSession().getProvider(RealmProvider.class)).preRemove(realm, role); } } diff --git a/model/map/src/main/java/org/keycloak/models/map/client/MapClientProviderFactory.java b/model/map/src/main/java/org/keycloak/models/map/client/MapClientProviderFactory.java index 9070912f1a..a82c1985f3 100644 --- a/model/map/src/main/java/org/keycloak/models/map/client/MapClientProviderFactory.java +++ b/model/map/src/main/java/org/keycloak/models/map/client/MapClientProviderFactory.java @@ -81,7 +81,7 @@ public class MapClientProviderFactory extends AbstractMapProviderFactory