Jav*_*ner 12 hibernate spring-data-jpa spring-boot
我正在开发一个Spring Boot项目并使用Spring Data JPAwithHibernate作为JPA实现。
目前在我的application.yml文件中我有以下属性:
spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
generate_statistics: true
hibernate:
ddl-auto: none
dialect: org.hibernate.dialect.H2Dialect
Run Code Online (Sandbox Code Playgroud)
Hibernate 属性有不同的前缀(spring.jpa.properties.hibernate和spring.jpa.hibernate)
具有这些差异的目的是什么?它们可以互换使用,这意味着我可以替换spring.jpa.properties.hibernate.format_sql为spring.jpa.hibernate.format_sql?
161*_*903 13
Spring Boot 参考文档的配置 JPA 属性对此进行了解释:
--
spring.jpa.properties.*创建本地 EntityManagerFactory 时,中的所有属性都作为普通 JPA 属性(去除前缀)传递。
因此,spring.jpa.hibernate.X属性由 Spring 使用,并spring.jpa.properties传递给您正在使用的任何 JPA 实现,从而允许您设置 Spring 没有的配置属性。
| 归档时间: |
|
| 查看次数: |
13610 次 |
| 最近记录: |