SpringBoot+jpa适配国产达梦数据库
依赖:spring-boot-starter-data-jpa等其他Spring依赖版本都是2.1.5
<dependency> <groupId>com.damenggroupId> <artifactId>Dm8JdbcDriver18artifactId> <version>8.1.1.49version> dependency> <dependency> <groupId>com.damenggroupId> <artifactId>DmDialect-for-hibernate5.3artifactId> <version>8.1.1.49version> dependency> <dependency> <groupId>org.hibernategroupId> <artifactId>hibernate-coreartifactId> <version>5.3.18.Finalversion> dependency>
对应application.properties配置:
spring.datasource.url=jdbc:dm://ip:5236/
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
#方言
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DmDialect
spring.jpa.database-platform=org.hibernate.dialect.DmDialect
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.show_sql=true
#模式名称
spring.jpa.properties.hibernate.default_schema=ispatial
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
spring.data.redis.repositories.enabled = false
spring.datasource.dbcp2.test-on-borrow=true
spring.datasource.dbcp2.validation-query=SELECT 1
注:国产达梦数据库的SQL跟Oracle差不多,如果想手动创建表,若有对应Oracle SQL可直接运行创建。