diff --git a/pom.xml b/pom.xml index 5c5caa8..ad28173 100644 --- a/pom.xml +++ b/pom.xml @@ -47,19 +47,37 @@ + + org.slf4j + slf4j-api + + + org.hibernate + hibernate-core + + + javax.activation-api + javax.activation + + + org.springframework.boot - spring-boot-starter-data-jpa + spring-boot - org.springframework.boot - spring-boot-configuration-processor + spring-boot-autoconfigure + + + org.springframework + spring-context org.springframework.boot - spring-boot-starter-validation + spring-boot-configuration-processor + true @@ -67,12 +85,21 @@ spring-boot-starter-test test - com.h2database h2 test + + org.springframework.data + spring-data-jpa + test + + + org.springframework.data + spring-data-commons + test + diff --git a/src/main/java/com/yannbriancon/interceptor/HibernateQueryInterceptor.java b/src/main/java/com/yannbriancon/interceptor/HibernateQueryInterceptor.java index fa4ffb0..cca37bb 100644 --- a/src/main/java/com/yannbriancon/interceptor/HibernateQueryInterceptor.java +++ b/src/main/java/com/yannbriancon/interceptor/HibernateQueryInterceptor.java @@ -11,11 +11,7 @@ import javax.persistence.EntityManager; import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.function.Supplier; @Component @@ -57,6 +53,8 @@ private void resetNPlusOneQueryDetectionState() { * Clearing the Hibernate Session is necessary to detect N+1 queries in tests as they would be in production. * Otherwise, every objects created in the setup of the tests would already be loaded in the Session and would * hide potential N+1 queries. + * + * @param entityManager EntityManager for the session */ public void clearNPlusOneQuerySession(EntityManager entityManager) { entityManager.clear(); @@ -72,6 +70,8 @@ public void startQueryCount() { /** * Get the query count for the considered thread + * + * @return The query count */ public Long getQueryCount() { return threadQueryCount.get();