SpringBoot3默认集成的是Hibernate6,Hibernate6默认只能连接Oracle 19C及以上,启动时会有提示
2024-12-24 18:35:03,123 | SQL耗时: 12 ms | 连接信息: statement-0 | 执行语句:
select cast('string' as varchar2(32000)), sys_context('USERENV','CLOUD_SERVICE') from dual
2024-12-24 18:35:03,133 | SQL耗时: 2 ms | 连接信息: statement-0 | 执行语句:
select 1 from dual where sys_context('USERENV','CLOUD_SERVICE') in ('OLTP','DWCS','JDCS')
2024-12-24T18:35:03.145+08:00 WARN 25580 --- [aps-main] [ main] org.hibernate.dialect.Dialect : HHH000511: The 11.2.0 version for [org.hibernate.dialect.OracleDialect] is no longer supported, hence certain features may not work properly. The minimum supported version is 19.0.0. Check the community dialects project for available legacy versions.
2024-12-24T18:35:03.152+08:00 WARN 25580 --- [aps-main] [ main] org.hibernate.orm.deprecation : HHH90000025: OracleDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
2024-12-24T18:35:03.299+08:00 INFO 25580 --- [aps-main] [ main] org.hibernate.orm.connections.pooling : HHH10001005: Database info:
Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
Database driver: undefined/unknown
Database version: 11.2
Autocommit mode: undefined/unknown
Isolation level: undefined/unknown
Minimum pool size: undefined/unknown
Maximum pool size: undefined/unknown
由于项目使用的是11g,需要进行相应的配置
<!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-community-dialects -->
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-community-dialects</artifactId>
<version>6.6.4.Final</version>
</dependency>
spring:
jpa:
database: oracle
properties:
hibernate:
dialect: org.hibernate.community.dialect.OracleLegacyDialect
至此解决问题
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。