Skip to content

Commit c447d21

Browse files
authored
google#224 Add Docs for spring application properties (google#225)
1 parent 3018fe7 commit c447d21

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

java/sqlcommenter-java/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,35 @@ or alternatively just for a specific method
110110

111111
#### Hibernate
112112

113+
##### Hibernate via JPA
114+
113115
If you're using Hibernate via JPA, then you can simply set the `hibernate.session_factory.statement_inspector` configuration property in the `persistence.xml` configuration file:
114116

115117
```xml
116118
<property name="hibernate.session_factory.statement_inspector" value="com.google.cloud.sqlcommenter.schibernate.SCHibernate" />
117119
```
118120

121+
##### Hibernate via Spring Application Properties
122+
If you're using Hibernate via Spring application properties(i.e. you have `application.yml` or `application.properties` in your resources folder)
123+
- `application.properties`
124+
125+
```properties
126+
spring.jpa.properties.hibernate.session_factory.statement_inspector=com.google.cloud.sqlcommenter.schibernate.SCHibernate
127+
```
128+
129+
- `application.yml`
130+
131+
```yml
132+
spring:
133+
jpa:
134+
properties:
135+
hibernate:
136+
session_factory:
137+
statement_inspector: com.google.cloud.sqlcommenter.schibernate.SCHibernate
138+
```
139+
140+
##### Hibernate via Spring
141+
119142
If you're using Hibernate via Spring, then you might not use a `persistence.xml` configuration file, in which case,
120143
you can set up the `hibernate.session_factory.statement_inspector` configuration property as follows:
121144

0 commit comments

Comments
 (0)