Skip to content

Commit

Permalink
#224 Add Docs for spring application properties (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhwip authored Mar 22, 2023
1 parent 3018fe7 commit c447d21
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions java/sqlcommenter-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,35 @@ or alternatively just for a specific method

#### Hibernate

##### Hibernate via JPA

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:

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

##### Hibernate via Spring Application Properties
If you're using Hibernate via Spring application properties(i.e. you have `application.yml` or `application.properties` in your resources folder)
- `application.properties`

```properties
spring.jpa.properties.hibernate.session_factory.statement_inspector=com.google.cloud.sqlcommenter.schibernate.SCHibernate
```

- `application.yml`

```yml
spring:
jpa:
properties:
hibernate:
session_factory:
statement_inspector: com.google.cloud.sqlcommenter.schibernate.SCHibernate
```
##### Hibernate via Spring
If you're using Hibernate via Spring, then you might not use a `persistence.xml` configuration file, in which case,
you can set up the `hibernate.session_factory.statement_inspector` configuration property as follows:

Expand Down

0 comments on commit c447d21

Please sign in to comment.