Skip to content

Commit dafe2d7

Browse files
Intercept the generated SQL for logging or altering
1 parent d48054a commit dafe2d7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,3 +4099,13 @@ From Openjdk JEP359:
40994099

41004100
**Key points:**
41014101
- use `@IdClass`
4102+
4103+
-----------------------------------------------------------------------------------------------------------------------
4104+
4105+
280. **[How To Intercept The Generated SQL For Logging Or Altering](https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootInterceptSql)**
4106+
4107+
**Description:** Sometimes we need to intercept the generated SQL that originates from Spring Data, `EntityManager`, Criteria API, `JdbcTemplate` and so on. This can be done as in this sample application. After interception, you can log, modify or even return a brand new SQL that will be executed in the end.
4108+
4109+
**Key points:**
4110+
- define an implementation of Hibernate `StatementInspector` SPI
4111+
- configure this SPI in `application.properties` via `spring.jpa.properties.hibernate.session_factory.statement_inspector`

0 commit comments

Comments
 (0)