8000 Change the flush mode to auto and fixing check for entities loaded into the session by pedroigor · Pull Request #10623 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,6 @@ private Predicate[] getSearchOptionPredicateArray(String value, CriteriaBuilder

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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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;
Expand Down Expand Up @@ -110,6 +111,8 @@ protected EntityManager createEntityManager(EntityManagerFactory emf, KeycloakSe
entityManager = PersistenceExceptionConverter.create(session, emf.createEntityManager());
}

entityManager.setFlushMode(FlushModeType.AUTO);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I debug[1] it locally AUTO mode is already set. As far as I was able to find out AUTO is default. Am I missing something?

[1]

cd quarkus
mvn -f server/pom.xml -Dsuspend=true compile quarkus:dev -Dquarkus.args="start-dev"


return entityManager;
}
}
0