[keycloak-user] Close EntityManager in RealmResourceProvider?

Henning Waack henning.waack at codecentric.de
Fri Jul 27 04:17:53 EDT 2018


Hi.

I am implementing a RealmResourceProvider (KC 4.0) in which I use an
EntityManager provided by the KeycloakSession to access the KC DB:

EntityManager em =
((KeycloakSession)session).getProvider(JpaConnectionProvider.class).getEntityManager();

In my class which extends
org.keycloak.services.resource.RealmResourceProvider and uses this
EntityManager, do I have to close the EM instance after using it? Or do I
have to close it in my RealmResourceProviderFactory.close() method where I
obtain it from the session?

Thanks & greetings

Henning


More information about the keycloak-user mailing list