【问题标题】:Set hibernate dialect for jpa in YML在 YML 中为 jpa 设置休眠方言
【发布时间】:2018-09-28 00:32:35
【问题描述】:

我尝试在 YML 中为 jpa 设置休眠方言,

检查了很多主题,但没有设置:

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

如何解决这个问题?

【问题讨论】:

    标签: spring hibernate spring-boot jpa configuration


    【解决方案1】:

    com.x.data.core.hibernate.dialect.ExtendedH2Dialect 是什么?你必须使用方言作为org.hibernate.dialect.H2Dialect

    下面是示例

    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
    

    注意: 我正在使用spring-boot-starter-data-jpa 2.0.5

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-21
      • 2015-07-26
      • 2022-11-27
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      相关资源
      最近更新 更多