问题
I tried to set hibernate dialect for jpa in YML,
checked many topics, but it does not set:
spring:
datasource:
hikari:
allow-pool-suspension: true
connection-timeout: 1000
name: testDb
jpa:
database: h2
generate-ddl: false
database-platform: h2
package-to-scan: com.x.model
properties:
hibernate:
dialect: com.x.data.core.hibernate.dialect.ExtendedH2Dialect
h2:
console:
enabled: true
path: /h2
How to fix this?
回答1:
what is com.x.data.core.hibernate.dialect.ExtendedH2Dialect
? You have to use dialect as org.hibernate.dialect.H2Dialect
below is the sample
server:
port: 8096
spring:
datasource:
driverClassName: org.h2.Driver
url: jdbc:h2:~/test
username: sa
password:
h2:
console:
enabled: true
jpa:
hibernate.ddl-auto: update
generate-ddl: false
show-sql: false
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect
Note:
I'm using spring-boot-starter-data-jpa
2.0.5
来源:https://stackoverflow.com/questions/52546758/set-hibernate-dialect-for-jpa-in-yml