"Hibernate Dialect must be explicitly set"的解决办法

解决Hibernate方言配置问题

错误提示:没有设置数据库方言(dialect);

hibernate配置文件的方言设置为:

<property name="dialect">
			org.hibernate.dialect.MySQLDialect
		</property>

以上为mysql的方言配置。
在spring boot项目启动时,报错如下: Failed to instantiate [com.datastax.oss.driver.api.core.CqlSession]: Factory method 'cassandraSession' threw exception; nested exception is java.lang.IllegalStateException: Since you provided explicit contact points, the local DC must be explicitly set (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter). Current contact points are: Node(endPoint=/127.0.0.1:9042, hostId=5fa2e127-96a3-4bc7-96d0-42a3de83e831, hashCode=3b13c84f)=datacenter1. Current DCs in this cluster are: datacenter1 yaml文件配置如下所示 spring: profiles: active: mysql # 默认使用MySQL配置 grpc: server: port: 9091 system: max-user-limit: 10 management: endpoints: web: exposure: include: metrics # ==================== MySQL 配置 ==================== --- spring: config: activate: on-profile: mysql datasource: url: jdbc:mysql://localhost:3306/springbootdemo?useSSL=false&serverTimezone=UTC&characterEncoding=utf8 username: root password: 159357 driver-class-name: com.mysql.cj.jdbc.Driver jpa: show-sql: true hibernate: ddl-auto: update properties: hibernate: dialect: org.hibernate.dialect.MySQL8Dialect format_sql: true jdbc: lob: non_contextual_creation: true # ==================== Cassandra 配置 ==================== --- spring: config: activate: on-profile: cassandra # 激活cassandra profile时使用此配置 data: cassandra: keyspace-name: my_database # 替换为实际keyspace名称 local-datacenter: datacenter1 contact-points: localhost # Cassandra节点地址 port: 9042 # 默认Cassandra端口 compression: none connection: connect-timeout: 10s init-query-timeout: 10s
最新发布
08-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值