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
Hibernate is a powerful ORM, but you need to have control over the executed SQL queries to avoid huge performance problems (N+1 selects, silent updates, batch insert not working, etc...)
3
+
Hibernate is a powerful ORM, but you need to have control over the executed SQL queries to avoid **huge performance problems** (N+1 selects, silent updates, batch insert not working...)
4
4
5
-
You can enable SQL query logging, this is a great help in dev, but not in production.
5
+
You can enable SQL query logging, this is a great help in dev, but not in production. This tool helps you to count the **executed SQL queries by Hibernate in your integration tests**.
6
6
7
-
This tool helps you to count the real executed queries by Hibernate in your integration tests.
7
+
It consists of just an Hibernate SQL inspector service and a Spring Test Listener that controls it (no proxy around the Datasource).
8
8
9
-
It consists of just an Hibernate SQL inspector service and a Spring Test Listener that controls it (no proxy around the Datasource)
9
+
The assertion will work seamlessly whether you're testing Spring repositories or doing HTTP integration tests.
10
10
11
11
## Example
12
12
13
-
* You just have to add the @AssertSQLStatementCount annotation to your test and it will verify the SQL statements count at the end of the test:
13
+
* You just have to add the @AssertHibernateSQLCount annotation to your test and it will verify the SQL statements (SELECT, UPDATE, INSERT, DELETE) count at the end of the test:
* You can also use the static methods in your test method, but it's more complex because Hibernate [will try to delay the flush](https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/chapters/flushing/Flushing.html) of your entities states at the end of your application transaction, here we call flush manually:
0 commit comments