Hi there,within my listener factory's postInit method I’m creating a separate thread that needs to run a sql query by using entity manager from JPA provider.In thread I doKeycloakModelUtils.runJobInTransaction(sessionFactory, new KeycloakSessionTask() {
@Override
public void run(KeycloakSession session) {…EntityManager em = session.getProvider(JpaConnectionProvider.class).getEntityManager();TypedQuery<UserEntity> query = em.createQuery(
"select u from UserEntity u where u.realmId = :realmId order by u.username", UserEntity.class);Unfortunately I got java.lang.NoClassDefFoundError: javax/persistence/EntityManagerI tried to set various class loaders viathread.setContextClassLoader(DefaultJpaConnectionProviderFactory.class.getClassLoader());but with no success.I’m running this on EAP 6.4.What is the proper way how to retrieve entity manager for running custom queries?
_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user