Change the flush mode to auto and fixing how entities are checked if they are loaded in the EM
Closes #10411
This commit is contained in:
parent
f06ba05405
commit
ad865e75c1
2 changed files with 4 additions and 2 deletions
|
@ -1083,7 +1083,6 @@ public class JpaUserProvider implements UserProvider.Streams, UserCredentialStor
|
|||
|
||||
private UserEntity userInEntityManagerContext(String id) {
|
||||
UserEntity user = em.getReference(UserEntity.class, id);
|
||||
boolean isLoaded = em.getEntityManagerFactory().getPersistenceUnitUtil().isLoaded(user);
|
||||
return isLoaded ? user : null;
|
||||
return em.contains(user) ? user : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.enterprise.inject.Instance;
|
|||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.FlushModeType;
|
||||
import javax.persistence.SynchronizationType;
|
||||
import org.hibernate.internal.SessionFactoryImpl;
|
||||
import org.keycloak.Config;
|
||||
|
@ -110,6 +111,8 @@ public abstract class AbstractJpaConnectionProviderFactory implements JpaConnect
|
|||
entityManager = PersistenceExceptionConverter.create(session, emf.createEntityManager());
|
||||
}
|
||||
|
||||
entityManager.setFlushMode(FlushModeType.AUTO);
|
||||
|
||||
return entityManager;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue