diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/locking/LockingConnectionProviderFactory.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/locking/LockingConnectionProviderFactory.java index f51d58734e..68da34dac2 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/locking/LockingConnectionProviderFactory.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/locking/LockingConnectionProviderFactory.java @@ -42,7 +42,7 @@ public class LockingConnectionProviderFactory extends DefaultInfinispanConnectio protected void initEmbedded() { super.initEmbedded(); ConfigurationBuilder counterConfigBuilder = new ConfigurationBuilder(); - counterConfigBuilder//.invocationBatching().enable() + counterConfigBuilder.invocationBatching().enable() .transaction().transactionMode(TransactionMode.TRANSACTIONAL); counterConfigBuilder.transaction().transactionManagerLookup(new DummyTransactionManagerLookup()); counterConfigBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC); diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java index 09e574f591..4d632ec14d 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java @@ -755,7 +755,7 @@ public class RealmAdapter implements RealmModel { entity.setEnabled(true); entity.setStandardFlowEnabled(true); entity.setRealm(realm); - //realm.getClients().add(entity); + realm.getClients().add(entity); em.persist(entity); em.flush(); final ClientModel resource = new ClientAdapter(this, em, session, entity); @@ -781,7 +781,6 @@ public class RealmAdapter implements RealmModel { client.removeRole(role); } - /* ClientEntity clientEntity = null; Iterator it = realm.getClients().iterator(); while (it.hasNext()) { @@ -797,8 +796,6 @@ public class RealmAdapter implements RealmModel { clientEntity = a; } } - */ - ClientEntity clientEntity = em.find(ClientEntity.class, id); if (clientEntity == null) return false; em.createNamedQuery("deleteScopeMappingByClient").setParameter("client", clientEntity).executeUpdate(); em.remove(clientEntity); @@ -1020,6 +1017,7 @@ public class RealmAdapter implements RealmModel { entity.setFullSyncPeriod(model.getFullSyncPeriod()); entity.setChangedSyncPeriod(model.getChangedSyncPeriod()); entity.setLastSync(model.getLastSync()); + entity.setRealm(realm); em.persist(entity); realm.getUserFederationProviders().add(entity); diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java index da369f0cce..76aa238b6a 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java @@ -141,20 +141,16 @@ public class RealmEntity { @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = "realm") Collection requiredCredentials = new ArrayList(); - @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true) - @JoinTable(name="FED_PROVIDERS", joinColumns={ @JoinColumn(name="REALM_ID") }, inverseJoinColumns={ @JoinColumn(name = "USERFEDERATIONPROVIDERS_ID") }) + @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = "realm") List userFederationProviders = new ArrayList(); @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = "realm") Collection userFederationMappers = new ArrayList(); - //@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy="realm") - //@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true) - //@JoinTable(name="REALM_CLIENT", joinColumns={ @JoinColumn(name="REALM_ID") }, inverseJoinColumns={ @JoinColumn(name="CLIENT_ID") }) - //Collection clients = new ArrayList<>(); + @OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy="realm") + Collection clients = new ArrayList<>(); - @OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true) - @JoinTable(name="REALM_CLIENT_TEMPLATE", joinColumns={ @JoinColumn(name="REALM_ID") }, inverseJoinColumns={ @JoinColumn(name="CLIENT_TEMPLATE_ID") }) + @OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = "realm") Collection clientTemplates = new ArrayList<>(); @OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, mappedBy = "realm") @@ -425,7 +421,6 @@ public class RealmEntity { public void setRequiredCredentials(Collection requiredCredentials) { this.requiredCredentials = requiredCredentials; } - /* public Collection getClients() { return clients; } @@ -433,7 +428,6 @@ public class RealmEntity { public void setClients(Collection clients) { this.clients = clients; } - */ public Collection getRoles() { return roles; diff --git a/model/jpa/src/main/resources/META-INF/jpa-changelog-1.9.0.xml b/model/jpa/src/main/resources/META-INF/jpa-changelog-1.9.0.xml old mode 100644 new mode 100755 index 38374e70ee..99b47bcbf4 --- a/model/jpa/src/main/resources/META-INF/jpa-changelog-1.9.0.xml +++ b/model/jpa/src/main/resources/META-INF/jpa-changelog-1.9.0.xml @@ -60,5 +60,21 @@ ACCESS_TOKEN_LIFE_IMPLICIT is NULL + + + + + + + + + + + + + + + + \ No newline at end of file