Set hibernate dialect for jpa in YML

佐手、 提交于 2020-06-18 03:15:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!