From 37479a9afe6ef2fa806298764ce62121172d6b6e Mon Sep 17 00:00:00 2001 From: vramik Date: Tue, 5 Sep 2017 14:34:43 +0200 Subject: [PATCH] KEYCLOAK-5405 add synchronization of the persistence context when creating a group --- .../src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java | 1 + 1 file changed, 1 insertion(+) diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java index f57c4f2a6a..3a85825e9d 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java @@ -418,6 +418,7 @@ public class JpaRealmProvider implements RealmProvider { RealmEntity realmEntity = em.getReference(RealmEntity.class, realm.getId()); groupEntity.setRealm(realmEntity); em.persist(groupEntity); + em.flush(); realmEntity.getGroups().add(groupEntity); GroupAdapter adapter = new GroupAdapter(realm, em, groupEntity);