You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.contains("N+1 queries detected on a getter of the entity com.yannbriancon.utils.entity.User\n"+
192
+
" at com.yannbriancon.interceptor.NPlusOneQueriesExceptionTest"+
193
+
".getMessageAuthorNameWithNPlusOneQuery");
194
+
}
195
+
}
196
+
```
197
+
160
198
#### Configuration
161
199
200
+
##### Enable
201
+
202
+
By default the detection of N+1 queries is enabled for every profile.
203
+
204
+
To disable it, you can set the property `spring-hibernate-query-utils.n-plus-one-queries-detection.error-level` to false.
205
+
206
+
207
+
##### Error level
208
+
162
209
By default the detection of N+1 queries logs an error to avoid breaking your code.
163
210
164
211
However, my advice is to override the default error level to throw exceptions for your test profile.
165
212
166
213
Now you will easily detect which tests are failing and be able to flag them and set the error level to error logs only on
167
214
those tests while you are fixing them.
168
215
169
-
To do this, you can configure the error level when N+1 queries is detected using the property `hibernate.query.interceptor.error-level`.
216
+
To do this, you can configure the error level when N+1 queries is detected using the property `spring-hibernate-query-utils.n-plus-one-queries-detection.error-level`.
170
217
171
218
4 levels are available to handle the detection of N+1 queries:
172
219
@@ -237,6 +284,11 @@ public class NotificationResourceIntTest {
237
284
238
285
See [`CHANGELOG`][changelog-url] for more information.
239
286
287
+
<!-- CONTRIBUTING -->
288
+
## Contributing
289
+
290
+
See [`CONTRIBUTING`][contributing] for more information.
0 commit comments